linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH] lib/vsprintf.c: remove %Z support
Date: Wed, 4 Jan 2017 11:33:14 +0200	[thread overview]
Message-ID: <CAHp75VfTCwnc7zJ7YFPpJCMRskWDzdQhXxHuKOE8RqADD6Fkyg@mail.gmail.com> (raw)
In-Reply-To: <20170103230126.GA30170@avx2>

On Wed, Jan 4, 2017 at 1:01 AM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> Now that %z is standartised in C99 there is no reason to support %Z.
> Unlike %L it doesn't even make format strings smaller.

For the following files:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

>  drivers/net/ethernet/cadence/macb.c                         |    2
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |    2
>  drivers/net/wireless/intel/iwlegacy/4965-mac.c              |   30 ++---
>  drivers/net/wireless/intel/iwlwifi/iwl-drv.c                |   16 +--

>  kernel/relay.c                                              |    2
>  lib/vsprintf.c                                              |    8 -
>  mm/dmapool.c                                                |    2

>  sound/soc/soc-core.c                                        |    2

And couple of comment below.

> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -1566,7 +1566,7 @@ static void macb_init_rx_buffer_size(struct macb *bp, size_t size)
>                 }
>         }
>
> -       netdev_dbg(bp->dev, "mtu [%u] rx_buffer_size [%Zu]\n",
> +       netdev_dbg(bp->dev, "mtu [%u] rx_buffer_size [%zu]\n",
>                    bp->dev->mtu, bp->rx_buffer_size);
>  }

> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -4878,7 +4878,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
>                 kfree(af_params);
>         } else {
>                 brcmf_dbg(TRACE, "Unhandled, fc=%04x!!\n", mgmt->frame_control);
> -               brcmf_dbg_hex_dump(true, buf, len, "payload, len=%Zu\n", len);
> +               brcmf_dbg_hex_dump(true, buf, len, "payload, len=%zu\n", len);
>         }
>
>  exit:
> --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> @@ -4855,39 +4855,39 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
>          */
>
>         D_INFO("f/w package hdr ucode version raw = 0x%x\n", il->ucode_ver);
> -       D_INFO("f/w package hdr runtime inst size = %Zd\n", pieces.inst_size);
> -       D_INFO("f/w package hdr runtime data size = %Zd\n", pieces.data_size);
> -       D_INFO("f/w package hdr init inst size = %Zd\n", pieces.init_size);
> -       D_INFO("f/w package hdr init data size = %Zd\n", pieces.init_data_size);
> -       D_INFO("f/w package hdr boot inst size = %Zd\n", pieces.boot_size);
> +       D_INFO("f/w package hdr runtime inst size = %zd\n", pieces.inst_size);
> +       D_INFO("f/w package hdr runtime data size = %zd\n", pieces.data_size);
> +       D_INFO("f/w package hdr init inst size = %zd\n", pieces.init_size);
> +       D_INFO("f/w package hdr init data size = %zd\n", pieces.init_data_size);
> +       D_INFO("f/w package hdr boot inst size = %zd\n", pieces.boot_size);
>
>         /* Verify that uCode images will fit in card's SRAM */
>         if (pieces.inst_size > il->hw_params.max_inst_size) {
> -               IL_ERR("uCode instr len %Zd too large to fit in\n",
> +               IL_ERR("uCode instr len %zd too large to fit in\n",
>                        pieces.inst_size);
>                 goto try_again;
>         }
>
>         if (pieces.data_size > il->hw_params.max_data_size) {
> -               IL_ERR("uCode data len %Zd too large to fit in\n",
> +               IL_ERR("uCode data len %zd too large to fit in\n",
>                        pieces.data_size);
>                 goto try_again;
>         }
>
>         if (pieces.init_size > il->hw_params.max_inst_size) {
> -               IL_ERR("uCode init instr len %Zd too large to fit in\n",
> +               IL_ERR("uCode init instr len %zd too large to fit in\n",
>                        pieces.init_size);
>                 goto try_again;
>         }
>
>         if (pieces.init_data_size > il->hw_params.max_data_size) {
> -               IL_ERR("uCode init data len %Zd too large to fit in\n",
> +               IL_ERR("uCode init data len %zd too large to fit in\n",
>                        pieces.init_data_size);
>                 goto try_again;
>         }
>
>         if (pieces.boot_size > il->hw_params.max_bsm_size) {
> -               IL_ERR("uCode boot instr len %Zd too large to fit in\n",
> +               IL_ERR("uCode boot instr len %zd too large to fit in\n",
>                        pieces.boot_size);
>                 goto try_again;
>         }
> @@ -4938,7 +4938,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
>         /* Copy images into buffers for card's bus-master reads ... */
>
>         /* Runtime instructions (first block of data in file) */
> -       D_INFO("Copying (but not loading) uCode instr len %Zd\n",
> +       D_INFO("Copying (but not loading) uCode instr len %zd\n",
>                pieces.inst_size);
>         memcpy(il->ucode_code.v_addr, pieces.inst, pieces.inst_size);
>
> @@ -4949,28 +4949,28 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
>          * Runtime data
>          * NOTE:  Copy into backup buffer will be done in il_up()
>          */
> -       D_INFO("Copying (but not loading) uCode data len %Zd\n",
> +       D_INFO("Copying (but not loading) uCode data len %zd\n",
>                pieces.data_size);
>         memcpy(il->ucode_data.v_addr, pieces.data, pieces.data_size);
>         memcpy(il->ucode_data_backup.v_addr, pieces.data, pieces.data_size);
>
>         /* Initialization instructions */
>         if (pieces.init_size) {
> -               D_INFO("Copying (but not loading) init instr len %Zd\n",
> +               D_INFO("Copying (but not loading) init instr len %zd\n",
>                        pieces.init_size);
>                 memcpy(il->ucode_init.v_addr, pieces.init, pieces.init_size);
>         }
>
>         /* Initialization data */
>         if (pieces.init_data_size) {
> -               D_INFO("Copying (but not loading) init data len %Zd\n",
> +               D_INFO("Copying (but not loading) init data len %zd\n",
>                        pieces.init_data_size);
>                 memcpy(il->ucode_init_data.v_addr, pieces.init_data,
>                        pieces.init_data_size);
>         }
>
>         /* Bootstrap instructions */
> -       D_INFO("Copying (but not loading) boot instr len %Zd\n",
> +       D_INFO("Copying (but not loading) boot instr len %zd\n",
>                pieces.boot_size);
>         memcpy(il->ucode_boot.v_addr, pieces.boot, pieces.boot_size);
>
> --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> @@ -1096,21 +1096,21 @@ static int validate_sec_sizes(struct iwl_drv *drv,
>                               struct iwl_firmware_pieces *pieces,
>                               const struct iwl_cfg *cfg)
>  {
> -       IWL_DEBUG_INFO(drv, "f/w package hdr runtime inst size = %Zd\n",
> +       IWL_DEBUG_INFO(drv, "f/w package hdr runtime inst size = %zd\n",
>                 get_sec_size(pieces, IWL_UCODE_REGULAR,
>                              IWL_UCODE_SECTION_INST));
> -       IWL_DEBUG_INFO(drv, "f/w package hdr runtime data size = %Zd\n",
> +       IWL_DEBUG_INFO(drv, "f/w package hdr runtime data size = %zd\n",
>                 get_sec_size(pieces, IWL_UCODE_REGULAR,
>                              IWL_UCODE_SECTION_DATA));
> -       IWL_DEBUG_INFO(drv, "f/w package hdr init inst size = %Zd\n",
> +       IWL_DEBUG_INFO(drv, "f/w package hdr init inst size = %zd\n",
>                 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST));
> -       IWL_DEBUG_INFO(drv, "f/w package hdr init data size = %Zd\n",
> +       IWL_DEBUG_INFO(drv, "f/w package hdr init data size = %zd\n",
>                 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA));
>
>         /* Verify that uCode images will fit in card's SRAM. */
>         if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) >
>             cfg->max_inst_size) {
> -               IWL_ERR(drv, "uCode instr len %Zd too large to fit in\n",
> +               IWL_ERR(drv, "uCode instr len %zd too large to fit in\n",
>                         get_sec_size(pieces, IWL_UCODE_REGULAR,
>                                      IWL_UCODE_SECTION_INST));
>                 return -1;
> @@ -1118,7 +1118,7 @@ static int validate_sec_sizes(struct iwl_drv *drv,
>
>         if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) >
>             cfg->max_data_size) {
> -               IWL_ERR(drv, "uCode data len %Zd too large to fit in\n",
> +               IWL_ERR(drv, "uCode data len %zd too large to fit in\n",
>                         get_sec_size(pieces, IWL_UCODE_REGULAR,
>                                      IWL_UCODE_SECTION_DATA));
>                 return -1;
> @@ -1126,7 +1126,7 @@ static int validate_sec_sizes(struct iwl_drv *drv,
>
>         if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) >
>              cfg->max_inst_size) {
> -               IWL_ERR(drv, "uCode init instr len %Zd too large to fit in\n",
> +               IWL_ERR(drv, "uCode init instr len %zd too large to fit in\n",
>                         get_sec_size(pieces, IWL_UCODE_INIT,
>                                      IWL_UCODE_SECTION_INST));
>                 return -1;
> @@ -1134,7 +1134,7 @@ static int validate_sec_sizes(struct iwl_drv *drv,
>
>         if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA) >
>             cfg->max_data_size) {
> -               IWL_ERR(drv, "uCode init data len %Zd too large to fit in\n",
> +               IWL_ERR(drv, "uCode init data len %zd too large to fit in\n",
>                         get_sec_size(pieces, IWL_UCODE_REGULAR,
>                                      IWL_UCODE_SECTION_DATA));
>                 return -1;

> --- a/kernel/relay.c
> +++ b/kernel/relay.c
> @@ -847,7 +847,7 @@ void relay_close(struct rchan *chan)
>
>         if (chan->last_toobig)
>                 printk(KERN_WARNING "relay: one or more items not logged "
> -                      "[item size (%Zd) > sub-buffer size (%Zd)]\n",
> +                      "[item size (%zd) > sub-buffer size (%zd)]\n",
>                        chan->last_toobig, chan->subbuf_size);
>
>         list_del(&chan->list);

> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1739,6 +1739,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>   * 'h', 'l', or 'L' for integer fields
>   * 'z' support added 23/7/1999 S.H.
>   * 'z' changed to 'Z' --davidm 1/25/99
> + * 'Z' changed to 'z' --adobriyan 2017-01-25
>   * 't' added for ptrdiff_t
>   *
>   * @fmt: the format string
> @@ -1838,7 +1839,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>         /* get the conversion qualifier */
>         qualifier = 0;

>         if (*fmt == 'h' || _tolower(*fmt) == 'l' ||
> -           _tolower(*fmt) == 'z' || *fmt == 't') {
> +           *fmt == 'z' || *fmt == 't') {

Can it be one line?

> @@ -2657,7 +2658,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
>                 /* get conversion qualifier */
>                 qualifier = -1;

>                 if (*fmt == 'h' || _tolower(*fmt) == 'l' ||
> -                   _tolower(*fmt) == 'z') {
> +                   *fmt == 'z') {

Ditto.

> --- a/mm/dmapool.c
> +++ b/mm/dmapool.c
> @@ -93,7 +93,7 @@ show_pools(struct device *dev, struct device_attribute *attr, char *buf)
>                 spin_unlock_irq(&pool->lock);
>
>                 /* per-pool info, no real statistics yet */
> -               temp = scnprintf(next, size, "%-16s %4u %4Zu %4Zu %2u\n",
> +               temp = scnprintf(next, size, "%-16s %4u %4zu %4zu %2u\n",
>                                  pool->name, blocks,
>                                  pages * (pool->allocation / pool->size),
>                                  pool->size, pages);

> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -2879,7 +2879,7 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
>         unsigned int i;
>         int ret;
>
> -       dev_dbg(dev, "ASoC: dai register %s #%Zu\n", dev_name(dev), count);
> +       dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count);
>
>         component->dai_drv = dai_drv;

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2017-01-04  9:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 23:01 [PATCH] lib/vsprintf.c: remove %Z support Alexey Dobriyan
2017-01-04  9:33 ` Andy Shevchenko [this message]
2017-01-10  0:05   ` Alexey Dobriyan
2017-01-06  0:07 ` Andrew Morton
2017-01-09 23:59   ` [PATCH] checkpatch.pl: warn against using %Z Alexey Dobriyan
2017-01-09 22:16     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75VfTCwnc7zJ7YFPpJCMRskWDzdQhXxHuKOE8RqADD6Fkyg@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).