linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Schnelle <schnelle@linux.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-pci@vger.kernel.org, "Arnd Bergmann" <arnd@kernel.org>,
	"Damien Le Moal" <damien.lemoal@opensource.wdc.com>,
	linux-ide@vger.kernel.org
Subject: Re: [PATCH v4 02/41] ata: add HAS_IOPORT dependencies
Date: Tue, 16 May 2023 22:18:52 +0900	[thread overview]
Message-ID: <da77a377-4a9e-be8d-7b14-aeb270b7183e@kernel.org> (raw)
In-Reply-To: <20230516110038.2413224-3-schnelle@linux.ibm.com>

On 5/16/23 19:59, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>       per-subsystem patches may be applied independently
> 
>  drivers/ata/Kconfig       | 28 ++++++++++++++--------------
>  drivers/ata/ata_generic.c |  2 ++
>  drivers/ata/libata-sff.c  |  2 ++
>  include/linux/libata.h    |  2 ++
>  4 files changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 42b51c9812a0..c521cdc51f8c 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -557,7 +557,7 @@ comment "PATA SFF controllers with BMDMA"
>  
>  config PATA_ALI
>  	tristate "ALi PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	select PATA_TIMINGS
>  	help
>  	  This option enables support for the ALi ATA interfaces
> @@ -567,7 +567,7 @@ config PATA_ALI
>  
>  config PATA_AMD
>  	tristate "AMD/NVidia PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	select PATA_TIMINGS
>  	help
>  	  This option enables support for the AMD and NVidia PATA
> @@ -585,7 +585,7 @@ config PATA_ARASAN_CF
>  
>  config PATA_ARTOP
>  	tristate "ARTOP 6210/6260 PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for ARTOP PATA controllers.
>  
> @@ -612,7 +612,7 @@ config PATA_ATP867X
>  
>  config PATA_CMD64X
>  	tristate "CMD64x PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	select PATA_TIMINGS
>  	help
>  	  This option enables support for the CMD64x series chips
> @@ -659,7 +659,7 @@ config PATA_CS5536
>  
>  config PATA_CYPRESS
>  	tristate "Cypress CY82C693 PATA support (Very Experimental)"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	select PATA_TIMINGS
>  	help
>  	  This option enables support for the Cypress/Contaq CY82C693
> @@ -707,7 +707,7 @@ config PATA_HPT366
>  
>  config PATA_HPT37X
>  	tristate "HPT 370/370A/371/372/374/302 PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for the majority of the later HPT
>  	  PATA controllers via the new ATA layer.
> @@ -716,7 +716,7 @@ config PATA_HPT37X
>  
>  config PATA_HPT3X2N
>  	tristate "HPT 371N/372N/302N PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for the N variant HPT PATA
>  	  controllers via the new ATA layer.
> @@ -819,7 +819,7 @@ config PATA_MPC52xx
>  
>  config PATA_NETCELL
>  	tristate "NETCELL Revolution RAID support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for the Netcell Revolution RAID
>  	  PATA controller.
> @@ -855,7 +855,7 @@ config PATA_OLDPIIX
>  
>  config PATA_OPTIDMA
>  	tristate "OPTI FireStar PATA support (Very Experimental)"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables DMA/PIO support for the later OPTi
>  	  controllers found on some old motherboards and in some
> @@ -865,7 +865,7 @@ config PATA_OPTIDMA
>  
>  config PATA_PDC2027X
>  	tristate "Promise PATA 2027x support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for Promise PATA pdc20268 to pdc20277 host adapters.
>  
> @@ -873,7 +873,7 @@ config PATA_PDC2027X
>  
>  config PATA_PDC_OLD
>  	tristate "Older Promise PATA controller support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for the Promise 20246, 20262, 20263,
>  	  20265 and 20267 adapters.
> @@ -901,7 +901,7 @@ config PATA_RDC
>  
>  config PATA_SC1200
>  	tristate "SC1200 PATA support"
> -	depends on PCI && (X86_32 || COMPILE_TEST)
> +	depends on PCI && (X86_32 || COMPILE_TEST) && HAS_IOPORT
>  	help
>  	  This option enables support for the NatSemi/AMD SC1200 SoC
>  	  companion chip used with the Geode processor family.
> @@ -919,7 +919,7 @@ config PATA_SCH
>  
>  config PATA_SERVERWORKS
>  	tristate "SERVERWORKS OSB4/CSB5/CSB6/HT1000 PATA support"
> -	depends on PCI
> +	depends on PCI && HAS_IOPORT
>  	help
>  	  This option enables support for the Serverworks OSB4/CSB5/CSB6 and
>  	  HT1000 PATA controllers, via the new ATA layer.
> @@ -1183,7 +1183,7 @@ config ATA_GENERIC
>  
>  config PATA_LEGACY
>  	tristate "Legacy ISA PATA support (Experimental)"
> -	depends on (ISA || PCI)
> +	depends on (ISA || PCI) && HAS_IOPORT
>  	select PATA_TIMINGS
>  	help
>  	  This option enables support for ISA/VLB/PCI bus legacy PATA
> diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
> index 2f57ec00ab82..2d391d117f74 100644
> --- a/drivers/ata/ata_generic.c
> +++ b/drivers/ata/ata_generic.c
> @@ -197,8 +197,10 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
>  	if (!(command & PCI_COMMAND_IO))
>  		return -ENODEV;
>  
> +#ifdef CONFIG_PATA_ALI
>  	if (dev->vendor == PCI_VENDOR_ID_AL)
>  		ata_pci_bmdma_clear_simplex(dev);
> +#endif /* CONFIG_PATA_ALI */

You can drop this change if...

>  
>  	if (dev->vendor == PCI_VENDOR_ID_ATI) {
>  		int rc = pcim_enable_device(dev);
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 9d28badfe41d..80137edb7ebf 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -3031,6 +3031,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_port_start32);
>  
>  #ifdef CONFIG_PCI
>  
> +#ifdef CONFIG_HAS_IOPORT
>  /**
>   *	ata_pci_bmdma_clear_simplex -	attempt to kick device out of simplex
>   *	@pdev: PCI device
> @@ -3056,6 +3057,7 @@ int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex);
> +#endif /* CONFIG_HAS_IOPORT */

...you move the #ifdef CONFIG_HAS_IOPORT inside the function as the first line
and have the #endif right before the last "return 0;" (so the function only does
return 0 for the !CONFIG_HAS_IOPORT case).

>  
>  static void ata_bmdma_nodma(struct ata_host *host, const char *reason)
>  {
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 311cd93377c7..90002d4a785b 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -2012,7 +2012,9 @@ extern int ata_bmdma_port_start(struct ata_port *ap);
>  extern int ata_bmdma_port_start32(struct ata_port *ap);
>  
>  #ifdef CONFIG_PCI
> +#ifdef CONFIG_HAS_IOPORT
>  extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
> +#endif /* CONFIG_HAS_IOPORT */

And then you do not need these #ifdef/endif here. Overall, a lot less of #ifdef
which I personally really dislike to see in .c files :)

>  extern void ata_pci_bmdma_init(struct ata_host *host);
>  extern int ata_pci_bmdma_prepare_host(struct pci_dev *pdev,
>  				      const struct ata_port_info * const * ppi,

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2023-05-16 13:19 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 10:59 [PATCH v4 00/41] treewide: Remove I/O port accessors for HAS_IOPORT=n Niklas Schnelle
2023-05-16 10:59 ` [PATCH v4 01/41] kgdb: add HAS_IOPORT dependency Niklas Schnelle
2023-05-16 10:59 ` [PATCH v4 02/41] ata: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 13:18   ` Damien Le Moal [this message]
2023-05-16 13:23     ` Damien Le Moal
2023-05-19 12:46       ` Niklas Schnelle
2023-05-30 20:51   ` Sergey Shtylyov
2023-05-16 10:59 ` [PATCH v4 03/41] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
2023-05-16 11:06   ` Paul Menzel
2023-05-16 11:39     ` Niklas Schnelle
2023-05-16 11:46   ` Greg Kroah-Hartman
2023-05-16 12:35     ` Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 04/41] comedi: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 05/41] counter: " Niklas Schnelle
2023-05-19  1:26   ` William Breathitt Gray
2023-05-19 13:17     ` Niklas Schnelle
2023-05-19 13:38       ` Niklas Schnelle
2023-05-19 13:39         ` Niklas Schnelle
2023-05-19 14:21           ` William Breathitt Gray
2023-05-22 10:42             ` Niklas Schnelle
2023-05-22 11:15               ` William Breathitt Gray
2023-05-16 11:00 ` [PATCH v4 06/41] /dev/port: don't compile file operations without CONFIG_DEVPORT Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 17:13   ` Thomas Zimmermann
2023-05-16 17:47     ` Arnd Bergmann
2023-05-16 11:00 ` [PATCH v4 08/41] firmware: dmi-sysfs: handle HAS_IOPORT=n Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 09/41] gpio: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 12:57   ` Linus Walleij
2023-05-17 14:15   ` Bartosz Golaszewski
2023-05-16 11:00 ` [PATCH v4 10/41] hwmon: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 11/41] i2c: " Niklas Schnelle
2023-06-05 10:12   ` Wolfram Sang
2023-06-05 12:01     ` Niklas Schnelle
2023-06-05 20:05       ` Wolfram Sang
2023-06-05 12:01     ` Uwe Kleine-König
2023-06-05 12:55       ` Wolfram Sang
2023-05-16 11:00 ` [PATCH v4 12/41] iio: ad7606: Kconfig: " Niklas Schnelle
2023-05-20 15:40   ` Jonathan Cameron
2023-05-16 11:00 ` [PATCH v4 13/41] Input: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 14/41] Input: gameport: add ISA and " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 15/41] leds: add " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 16/41] media: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 17/41] misc: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 18/41] mISDN: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 19/41] mpt fusion: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 20/41] net: handle " Niklas Schnelle
2023-05-16 15:48   ` Maciej W. Rozycki
2023-05-16 11:00 ` [PATCH v4 21/41] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 22/41] PCI: Make quirk using inw() depend " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 23/41] PCI/sysfs: Make I/O resource " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 24/41] pcmcia: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 25/41] platform: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 26/41] pnp: " Niklas Schnelle
2023-05-16 11:55   ` Rafael J. Wysocki
2023-05-16 11:00 ` [PATCH v4 27/41] power: " Niklas Schnelle
2023-05-16 20:03   ` Sebastian Reichel
2023-05-16 11:00 ` [PATCH v4 28/41] rtc: " Niklas Schnelle
2023-05-16 15:49   ` Maciej W. Rozycki
2023-05-17  8:15     ` Niklas Schnelle
2023-05-17  9:53       ` Maciej W. Rozycki
2023-05-16 11:00 ` [PATCH v4 29/41] scsi: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 30/41] sound: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 31/41] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 32/41] staging: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 33/41] tty: serial: handle " Niklas Schnelle
2023-05-30 10:48   ` Greg Kroah-Hartman
2023-05-30 11:53     ` Arnd Bergmann
2023-05-30 14:31       ` Greg Kroah-Hartman
2023-05-16 11:00 ` [PATCH v4 34/41] usb: add " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 35/41] usb: uhci: handle " Niklas Schnelle
2023-05-16 16:29   ` Greg Kroah-Hartman
2023-05-16 16:44     ` Arnd Bergmann
2023-05-16 19:51       ` Alan Stern
2023-05-17  8:29         ` Niklas Schnelle
2023-05-16 20:17     ` Alan Stern
2023-05-17 12:17       ` Arnd Bergmann
2023-05-19 11:31         ` Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 36/41] usb: pci-quirks: " Niklas Schnelle
2023-05-30 11:00   ` Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination Niklas Schnelle
2023-05-16 12:24   ` Ville Syrjälä
2023-05-19 14:49     ` Helge Deller
2023-05-16 11:00 ` [PATCH v4 38/41] video: handle HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 17:21   ` Thomas Zimmermann
2023-05-17 12:41     ` Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 39/41] watchdog: add " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 40/41] wireless: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 41/41] asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n Niklas Schnelle

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=da77a377-4a9e-be8d-7b14-aeb270b7183e@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rafael@kernel.org \
    --cc=s.shtylyov@omp.ru \
    --cc=schnelle@linux.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=u.kleine-koenig@pengutronix.de \
    /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).