All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Sui Jingfeng <suijingfeng@loongson.cn>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	loongson-kernel@lists.loongnix.cn,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] linux/pci.h: add a dummy implement for pci_clear_master()
Date: Wed, 31 May 2023 12:16:25 -0500	[thread overview]
Message-ID: <ZHeA6eB5FocARdwl@bhelgaas> (raw)
In-Reply-To: <3c88cab1-e175-ddcf-b323-437890cc2eec@loongson.cn>

On Wed, May 31, 2023 at 12:25:10PM +0800, Sui Jingfeng wrote:
> On 2023/5/31 04:11, Bjorn Helgaas wrote:
> > On Tue, May 30, 2023 at 06:16:55PM +0800, Sui Jingfeng wrote:
> > > As some arch(m68k for example) doesn't have config_pci enabled, drivers[1]
> > > call pci_clear_master() without config_pci guard can not built.
> > > 
> > >     drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c:
> > >     In function 'etnaviv_gpu_pci_fini':
> > > > > drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c:32:9:
> > >     error: implicit declaration of function 'pci_clear_master';
> > >     did you mean 'pci_set_master'? [-Werror=implicit-function-declaration]
> > >        32 |         pci_clear_master(pdev);
> > >           |         ^~~~~~~~~~~~~~~~
> > >           |         pci_set_master
> > >     cc1: some warnings being treated as errors
> > > 
> > > [1] https://patchwork.freedesktop.org/patch/539977/?series=118522&rev=1
> > I don't mind adding a stub if it's needed, but I don't understand why
> > it's needed here.
> 
> For a single driver that supports both platform devices and PCI devices,
> 
> Sometimes there is no way to separate the PCI driver part and the platform
> driver part cleanly and clearly.
> 
> For example, the module_init() and module_exit() functions,
> 
> where we have to register PCI drivers and platform drivers there.
> 
> We can't simply let the entire driver depend on PCI in Kconfig,
> 
> This will make this driver unable to compile, which it's originally could.
> 
> The PCI core could do such a thing for us, and
> 
> There is no need to introduce a driver-specific guard then.
> 
> 
> There is already a dummy stub for pci_set_master().
> 
> Therefore, pci_clear_master() should also have a counterpart.
> 
> They should emerge in pairs.
> 
> This could probably eliminate pain for PCI driver writers,
> 
> This patch is still useful.
> 
> 
> >   The caller is in etnaviv_pci_drv.c, and if I
> > understand the patch at [1], etnaviv_pci_drv.c is only compiled when
> > CONFIG_PCI=y.
> 
> Yes, you are right. This is the right thing to do for the driver, though.
> 
> Pure PCI device driver does not need to worry about this.
> 
> Like drm/ast, drm/amdgpu, drm/radeon, etc.
> 
> But drm/etnaviv is special; it's a platform driver that could pass the
> compile test originally.
> 
> 
> When patching it (Etnaviv) with PCI device driver support,
> 
> This forces the PCI driver writer to add another config option.
> 
> (which depends on the PCI config option.) in the Kconfig.
> 
> For my case, it's theDRM_ETNAVIV_PCI_DRIVER config option.

So if I understand correctly, you would prefer not to add the
DRM_ETNAVIV_PCI_DRIVER config option, and if we add this stub, you
won't need to add it?

That's a good reason to add this patch.

Bjorn

  reply	other threads:[~2023-05-31 17:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 10:16 [PATCH] linux/pci.h: add a dummy implement for pci_clear_master() Sui Jingfeng
2023-05-30 20:11 ` Bjorn Helgaas
2023-05-31  4:25   ` Sui Jingfeng
2023-05-31 17:16     ` Bjorn Helgaas [this message]
2023-05-31 17:37       ` Sui Jingfeng
2023-05-31  7:04 ` Geert Uytterhoeven
2023-05-31  9:49   ` Sui Jingfeng
2023-06-06 16:13 ` Bjorn Helgaas
2023-06-06 17:48   ` Sui Jingfeng
2023-06-06 18:46     ` Bjorn Helgaas
2023-06-06 19:13       ` Sui Jingfeng

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=ZHeA6eB5FocARdwl@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=suijingfeng@loongson.cn \
    /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 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.