All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Matthias Kraemer <matthiasmartinsson@gmail.com>,
	ulf.hansson@linaro.org, linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci-pci: Use macros in pci_ids definition
Date: Fri, 5 May 2017 09:09:03 +0300	[thread overview]
Message-ID: <a9bec849-7abe-b934-f6c3-cae8e55d3a6e@intel.com> (raw)
In-Reply-To: <1493924158-2577-2-git-send-email-matthiasmartinsson@gmail.com>

On 04/05/17 21:55, Matthias Kraemer wrote:
> This patch applies the PCI_DEVICE_ macros to specify the pci_ids instead
> of open-coding them within the sdhci-pci driver.
> 
> v2,v3:
> Suggested-by Adrian Hunter <adrian.hunter@intel.com>
> Instead of using the generic PCI_ marcos, introduce device specific macros
> to be able to shorten the table entries even further.
> 
> v4:
> Fix compile-time issue

Thanks, it looks better, although I still have some concerns - see below.

> 
> Signed-off-by: Matthias Kraemer <matthiasmartinsson@gmail.com>
> ---
>  drivers/mmc/host/sdhci-pci-core.c | 619 +++++---------------------------------
>  drivers/mmc/host/sdhci-pci.h      |  41 ++-
>  2 files changed, 111 insertions(+), 549 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index 86560d5..d2b6115 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -992,554 +992,77 @@ static const struct sdhci_pci_fixes sdhci_amd = {
>  };
>  
>  static const struct pci_device_id pci_ids[] = {
> -	{
> -		.vendor		= PCI_VENDOR_ID_RICOH,
> -		.device		= PCI_DEVICE_ID_RICOH_R5C822,
> -		.subvendor	= PCI_ANY_ID,
> -		.subdevice	= PCI_ANY_ID,
> -		.driver_data	= (kernel_ulong_t)&sdhci_ricoh,
> -	},
> -
> -	{
> -		.vendor         = PCI_VENDOR_ID_RICOH,
> -		.device         = 0x843,
> -		.subvendor      = PCI_ANY_ID,
> -		.subdevice      = PCI_ANY_ID,
> -		.driver_data    = (kernel_ulong_t)&sdhci_ricoh_mmc,
> -	},
> -

<SNIP>

> -	{
> -		.vendor		= PCI_VENDOR_ID_AMD,
> -		.device		= PCI_ANY_ID,
> -		.class		= PCI_CLASS_SYSTEM_SDHCI << 8,
> -		.class_mask	= 0xFFFF00,
> -		.subvendor	= PCI_ANY_ID,
> -		.subdevice	= PCI_ANY_ID,
> -		.driver_data	= (kernel_ulong_t)&sdhci_amd,
> -	},
> -	{	/* Generic SD host controller */
> -		PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
> -	},
> -
> +	{SDHCI_PCI_DEVICE(RICOH, RICOH_R5C822, ricoh)},
> +	{SDHCI_PCI_DEVICE(RICOH, RICOH_0x843, ricoh_mmc)},

<SNIP>

> +	{SDHCI_PCI_DEVICE_CLASS(AMD, SYSTEM_SDHCI, PCI_CLASS_MASK, amd)},
> +	/* Generic SD host controller */
> +	{PCI_DEVICE_CLASS(SYSTEM_SDHCI, PCI_CLASS_MASK)},
>  	{ /* end: all zeroes */ },
>  };
>  
> diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
> index 36f7434..b3485cc 100644
> --- a/drivers/mmc/host/sdhci-pci.h
> +++ b/drivers/mmc/host/sdhci-pci.h
> @@ -2,7 +2,7 @@
>  #define __SDHCI_PCI_H
>  
>  /*
> - * PCI device IDs
> + * PCI device IDs, sub IDs
>   */
>  
>  #define PCI_DEVICE_ID_INTEL_PCH_SDIO0	0x8809
> @@ -38,6 +38,45 @@
>  #define PCI_DEVICE_ID_INTEL_GLK_EMMC	0x31cc
>  #define PCI_DEVICE_ID_INTEL_GLK_SDIO	0x31d0
>  
> +#define PCI_DEVICE_ID_RICOH_0x843	0x843
> +#define PCI_DEVICE_ID_RICOH_0xe822	0xe822
> +#define PCI_DEVICE_ID_RICOH_0xe823	0xe823
> +#define PCI_DEVICE_ID_SYSKONNECT_0x8000	0x8000
> +#define PCI_DEVICE_ID_VIA_0x95d0	0x95d0
> +#define PCI_DEVICE_ID_REALTEK_0x5250	0x5250
> +
> +#define PCI_DEVICE_ID_INTEL_SUB_0x7884	0x7884
> +
> +/*
> + * PCI device class and mask
> + */
> +
> +#define SYSTEM_SDHCI			(PCI_CLASS_SYSTEM_SDHCI << 8)
> +#define PCI_CLASS_MASK			0xFFFF00
> +
> +/*
> + * Macros for PCI device-description
> + */
> +
> +#define _PCI_VEND(vend) PCI_VENDOR_ID_##vend
> +#define _PCI_DEV(dev) PCI_DEVICE_ID_##dev

Without exception, the device is prefixed by the vendor, so this should be:

#define _PCI_DEV(vend, dev) PCI_DEVICE_ID_##vend##_##dev

> +
> +#define SDHCI_PCI_DEVICE(vend, dev, cfg) \
> +	.vendor = _PCI_VEND(vend), .device = _PCI_DEV(dev), \
> +	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
> +	.driver_data = (kernel_ulong_t)&(sdhci_##cfg)

Still don't understand why you don't put the {} brackets into the macro?

> +
> +#define SDHCI_PCI_DEVICE_SUB(vend, dev, subvend, subdev, cfg) \
> +	.vendor = _PCI_VEND(vend), .device = _PCI_DEV(dev), \
> +	.subvendor = _PCI_VEND(subvend), .subdevice = _PCI_DEV(subdev), \
> +	.driver_data = (kernel_ulong_t)&(sdhci_##cfg)
> +

Still don't understand why you don't put the {} brackets into the macro?

> +#define SDHCI_PCI_DEVICE_CLASS(vend, cl, cl_msk, cfg) \
> +	.vendor = _PCI_VEND(vend), .device = PCI_ANY_ID, \
> +	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
> +	.class = (cl), .class_mask = (cl_msk), \
> +	.driver_data = (kernel_ulong_t)&(sdhci_##cfg)

Still don't understand why you don't put the {} brackets into the macro?

> +
>  /*
>   * PCI registers
>   */
> 


  reply	other threads:[~2017-05-05  6:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04 18:55 [PATCH] mmc: sdhci-pci: Use macros in pci_ids definition Matthias Kraemer
2017-05-04 18:55 ` Matthias Kraemer
2017-05-05  6:09   ` Adrian Hunter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-05-15 21:44 [PATCH V6] " Matthias Kraemer
2017-05-15 21:44 ` [PATCH] " Matthias Kraemer
2017-05-30  9:09   ` Adrian Hunter
2017-05-30  9:55   ` Ulf Hansson
2017-05-07  7:15 Matthias Kraemer
2017-05-07  7:15 ` Matthias Kraemer
2017-05-08  7:23   ` Adrian Hunter
2017-05-04 18:43 Matthias Kraemer
2017-05-04 18:43 ` Matthias Kraemer
     [not found] <1491417893-16095-1-git-send-email-matthiasmartinsson@gmail.com>
     [not found] ` <1491417893-16095-2-git-send-email-matthiasmartinsson@gmail.com>
2017-04-13  8:52   ` Adrian Hunter
2017-04-12 20:37 Matthias Kraemer
2017-04-12 20:37 ` Matthias Kraemer

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=a9bec849-7abe-b934-f6c3-cae8e55d3a6e@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matthiasmartinsson@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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.