public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	Markus Schneider-Pargmann <msp@baylibre.com>,
	Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
	Frank Li <Frank.Li@kernel.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Viresh Kumar <vireshk@kernel.org>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: Consistently define pci_device_ids using named initializers
Date: Tue, 5 May 2026 10:01:30 +0300	[thread overview]
Message-ID: <afmVyj5LL83LKeUK@ashevche-desk.local> (raw)
In-Reply-To: <afjJ0YjzLgk-r9Nh@monoceros>

On Mon, May 04, 2026 at 06:38:51PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> On Mon, May 04, 2026 at 05:09:55PM +0300, Andy Shevchenko wrote:
> > On Mon, May 04, 2026 at 03:55:00PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > > On Mon, May 04, 2026 at 01:29:12PM +0300, Andy Shevchenko wrote:
> > > > On Mon, May 04, 2026 at 12:20:06PM +0200, Uwe Kleine-König (The Capable Hub) wrote:

...

> > > > >  static const struct pci_device_id pch_dma_id_table[] = {
> > > > > -	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },
> > > > > -	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), 4 },
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA1_8CH), 8}, /* UART Video */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA2_8CH), 8}, /* PCMIF SPI */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA3_4CH), 4}, /* FPGA */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA4_12CH), 12}, /* I2S */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA1_4CH), 4}, /* UART */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA2_4CH), 4}, /* Video SPI */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA3_4CH), 4}, /* Security */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA4_4CH), 4}, /* FPGA */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_DMA1_8CH), 8}, /* UART */
> > > > > -	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_DMA2_4CH), 4}, /* SPI */
> > > > > -	{ 0, },
> > > > > +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), .driver_data = 8 },
> > > > > +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), .driver_data = 4 },
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA1_8CH), .driver_data = 8 },		/* UART Video */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA2_8CH), .driver_data = 8 },		/* PCMIF SPI */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA3_4CH), .driver_data = 4 },		/* FPGA */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA4_12CH), .driver_data = 12 },	/* I2S */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA1_4CH), .driver_data = 4 },		/* UART */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA2_4CH), .driver_data = 4 },		/* Video SPI */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA3_4CH), .driver_data = 4 },		/* Security */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_DMA4_4CH), .driver_data = 4 },		/* FPGA */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_DMA1_8CH), .driver_data = 8 },		/* UART */
> > > > > +	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_DMA2_4CH), .driver_data = 4 },		/* SPI */
> > > > > +	{ },
> > > > >  };
> > > > 
> > > > Use PCI_DEVICE_DATA() instead. Same may apply to DesignWare, but one needs to
> > > > define the device IDs. I think I may help with that.
> > > 
> > > I'm not a fan of PCI_DEVICE_DATA. While it could indeed be used to
> > > shorten the assignments here, it's less readable in my opinion.
> > 
> > I'm not fun of these long unreadable lines with tons of repetitions :-)
> 
> Seems to be subjective.
> 
> > > Compare
> > > 
> > > 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), .driver_data = 4 },
> > > 
> > > with
> > > 
> > > 	{ PCI_DEVICE_DATA(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH, 4) },
> > 
> > First of all, with
> > 
> > 	{ PCI_DEVICE_DATA(INTEL, EG20T_PCH_DMA_4CH, 4) },
> 
> Agreed. That doesn't considerably weaken my reasoning however.
> 
> > > . For someone who doesn't know what PCI_DEVICE_DATA does, the latter is
> > > less understandable.
> > 
> > Same applicable to many other macros. I don't consider this argument viable.
> 
> Also agreed. But other bad macros don't justify using that (admittedly
> subjectively) bad PCI_DEVICE_DATA macro that mixes device identity
> (.vendor, .device, .subvendor and .subdevice) with a driver specific
> struct member.
> 
> > > Also PCI_DEVICE_DATA has a cast which is something I want to get rid of.
> > 
> > Yes, and you will get rid of in one place instead of tons of them.
> 
> This would require another (subjectively bad) macro PCI_DEVICE_DATAPTR.
> I think I let someone else tackle that quest.

No, it wouldn't. Since we support C11, we have _Generic(). It may be used.
And please use PCI_DEVICE_DATA() in this driver.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-05-05  7:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 10:20 [PATCH] dmaengine: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
2026-05-04 10:29 ` Andy Shevchenko
2026-05-04 13:55   ` Uwe Kleine-König (The Capable Hub)
2026-05-04 14:09     ` Andy Shevchenko
2026-05-04 16:38       ` Uwe Kleine-König (The Capable Hub)
2026-05-05  7:01         ` Andy Shevchenko [this message]
2026-05-05  7:04           ` Andy Shevchenko

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=afmVyj5LL83LKeUK@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=msp@baylibre.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vireshk@kernel.org \
    --cc=vkoul@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox