Re: [PATCH iwl-next 03/14] libeth: add PCI device initialization helpers to libeth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 08, 2025 at 02:47:49PM +0200, Larysa Zaremba wrote:
> From: Phani R Burra <phani.r.burra@xxxxxxxxx>
> 
> Add memory related support functions for drivers to access MMIO space and
> allocate/free dma buffers.
> 
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
> Signed-off-by: Phani R Burra <phani.r.burra@xxxxxxxxx>
> Co-developed-by: Victor Raj <victor.raj@xxxxxxxxx>
> Signed-off-by: Victor Raj <victor.raj@xxxxxxxxx>
> Co-developed-by: Sridhar Samudrala <sridhar.samudrala@xxxxxxxxx>
> Signed-off-by: Sridhar Samudrala <sridhar.samudrala@xxxxxxxxx>
> Co-developed-by: Pavan Kumar Linga <pavan.kumar.linga@xxxxxxxxx>
> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@xxxxxxxxx>
> Co-developed-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>

...

> diff --git a/drivers/net/ethernet/intel/libeth/pci.c b/drivers/net/ethernet/intel/libeth/pci.c

...

> +/**
> + * __libeth_pci_map_mmio_region - map PCI device MMIO region
> + * @mmio_info: struct to store the mapped MMIO region
> + * @offset: MMIO region start offset
> + * @size: MMIO region size
> + * @num_args: number of additional arguments present
> + *
> + * Return: true on success, false on memory map failure.
> + */
> +bool __libeth_pci_map_mmio_region(struct libeth_mmio_info *mmio_info,
> +				  resource_size_t offset,
> +				  resource_size_t size, int num_args, ...)
> +{
> +	struct pci_dev *pdev = mmio_info->pdev;
> +	struct libeth_pci_mmio_region *mr;
> +	resource_size_t pa;
> +	void __iomem *va;
> +	int bar_idx = 0;
> +	va_list args;
> +
> +	if (num_args) {
> +		va_start(args, num_args);
> +		bar_idx = va_arg(args, int);
> +		va_end(args);
> +	}
> +
> +	mr = libeth_find_mmio_region(&mmio_info->mmio_list, offset, bar_idx);
> +	if (mr) {
> +		pci_warn(pdev, "Mapping of BAR%u with offset %llu already exists\n",
> +			 bar_idx, offset);

Hi Phani, Larysa, all,

I think that the format specifier here should be %zu rather than %llu.

On ARM W=1 builds gcc 14.2.0 flags this as follows:

    CALL    scripts/checksyscalls.sh
    CC      drivers/net/ethernet/intel/libeth/pci.o
  In file included from ./include/linux/device.h:15,
                   from ./include/linux/pci.h:37,
                   from ./include/net/libeth/pci.h:7,
                   from drivers/net/ethernet/intel/libeth/pci.c:4:
  .../pci.c: In function '__libeth_pci_map_mmio_region':
  .../pci.c:92:32: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
     92 |                 pci_warn(pdev, "Mapping of BAR%u with offset %llu already exists\n",
        |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  .../dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
    110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
        |                              ^~~
  .../dev_printk.h:156:61: note: in expansion of macro 'dev_fmt'
    156 |         dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt), ##__VA_ARGS__)
        |                                                             ^~~~~~~
  .../pci.h:2704:41: note: in expansion of macro 'dev_warn'
   2704 | #define pci_warn(pdev, fmt, arg...)     dev_warn(&(pdev)->dev, fmt, ##arg)
        |                                         ^~~~~~~~
  .../pci.c:92:17: note: in expansion of macro 'pci_warn'
     92 |                 pci_warn(pdev, "Mapping of BAR%u with offset %llu already exists\n",
        |                 ^~~~~~~~
  .../pci.c:92:65: note: format string is defined here
     92 |                 pci_warn(pdev, "Mapping of BAR%u with offset %llu already exists\n",
        |                                                              ~~~^
        |                                                                 |
        |                                                                 long long unsigned int
        |                                                              %u




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux