All of lore.kernel.org
 help / color / mirror / Atom feed
* A question about pcim_iomap_regions() and Managed Device Resource API
@ 2018-09-30  9:15 Kevin Wilson
  2018-10-01 19:00 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wilson @ 2018-09-30  9:15 UTC (permalink / raw)
  To: linux-pci

HI, linux-pci developers,

There are very few Ethernet drivers which use
pcim_iomap_regions(); for example,
drivers/net/ethernet/realtek/r8169.c.

My question is: why do they use this
Managed Device Resource API and not
the regular Device Resource API (ioremap() for example), which is used in
**most** Ethernet Linux device drivers, for example, in I40E driver:

...
    err = pci_request_mem_regions(pdev, i40e_driver_name);
    ...
    hw->hw_addr = ioremap(pci_resource_start(pdev, 0), pf->ioremap_len);
...

Is there some inherent HW feature in r8169 (or the other
drivers, see list below) which requires using this API ? Is usage
of this API (the managed devices, with pcim_iomap_regions(), etc) is
mandatory for these device drivers, and cannot be
use in most drivers (like I40E and most of the others) ?

The other Linux Ethenet drivers that use
pcim_iomap_regions() are:
amd/xgbe, cavium/common/cavium_ptp.c, intel/ice/ice_main.c,
oki-semi/pch_gbe/pch_gbe_main.c, stmicro/stmmac/stmmac_pci.c,
synopsys/dwc-xlgmac-pci.c and toshiba/tc35815.c.

Regards,
Kevin W.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A question about pcim_iomap_regions() and Managed Device Resource API
  2018-09-30  9:15 A question about pcim_iomap_regions() and Managed Device Resource API Kevin Wilson
@ 2018-10-01 19:00 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2018-10-01 19:00 UTC (permalink / raw)
  To: Kevin Wilson; +Cc: linux-pci

Hi Kevin,

On Sun, Sep 30, 2018 at 12:15:01PM +0300, Kevin Wilson wrote:
> HI, linux-pci developers,
> 
> There are very few Ethernet drivers which use
> pcim_iomap_regions(); for example,
> drivers/net/ethernet/realtek/r8169.c.
> 
> My question is: why do they use this
> Managed Device Resource API and not
> the regular Device Resource API (ioremap() for example), which is used in
> **most** Ethernet Linux device drivers, for example, in I40E driver:
> 
> ...
>     err = pci_request_mem_regions(pdev, i40e_driver_name);
>     ...
>     hw->hw_addr = ioremap(pci_resource_start(pdev, 0), pf->ioremap_len);
> ...
> 
> Is there some inherent HW feature in r8169 (or the other
> drivers, see list below) which requires using this API ? Is usage
> of this API (the managed devices, with pcim_iomap_regions(), etc) is
> mandatory for these device drivers, and cannot be
> use in most drivers (like I40E and most of the others) ?
> 
> The other Linux Ethenet drivers that use
> pcim_iomap_regions() are:
> amd/xgbe, cavium/common/cavium_ptp.c, intel/ice/ice_main.c,
> oki-semi/pch_gbe/pch_gbe_main.c, stmicro/stmmac/stmmac_pci.c,
> synopsys/dwc-xlgmac-pci.c and toshiba/tc35815.c.

The choice of the managed API (pcim_iomap_regions(), etc) vs the
regular one (ioremap()) has nothing to do with the features of the
hardware.  It's completely up to the driver writer.  The managed API
[1] is intended to make things easier for the driver writer by
simplifying error and cleanup paths.

Bjorn

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/driver-model/devres.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-01 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-30  9:15 A question about pcim_iomap_regions() and Managed Device Resource API Kevin Wilson
2018-10-01 19:00 ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.