linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
	jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Subject: Re: [PATCH 3/4] fix module autoloading for ACPI enumerated devices
Date: Tue, 14 Jan 2014 16:00:17 +0800	[thread overview]
Message-ID: <1389686417.3309.8.camel@rzhang1-mobl4> (raw)
In-Reply-To: <20140113173525.GF29039-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On Mon, 2014-01-13 at 17:35 +0000, Mark Brown wrote:
> On Mon, Jan 13, 2014 at 09:48:31PM +0800, Zhang Rui wrote:
> > ACPI enumerated devices has ACPI style _HID and _CID strings,
> > all of these strings can be used for both driver loading and matching.
> 
> > But currently, in Platform, I2C and SPI bus, only the ACPI style
> > driver matching is supported by invoking acpi_driver_match_device()
> > in bus .match() callback.
> 
> I don't understand what this means, sorry.

sorry, I should be clearer about this.

>   As far as I can tell "ACPI
> style _HID and _CID strings" are something different to "ACPI style
> driver matching" but what that actually means is not at all clear to me
> so I don't know what problem this is intended to fix.
> 
I gave a more detailed description about the problem in the changelog of
patch 2/4.

Take the following piece of code for example,
static const struct acpi_device_id xxx_acpi_match[] = {
        { "INTABCD", 0 },
        { }
};
MODULE_DEVICE_TABLE(acpi, xxx_acpi_match);

this can be seen in a platform/I2C/SPI driver that supports an ACPI
enumerated device, right?

If this piece of code is used in a platform driver for
an ACPI enumerated platform device, the platform DRIVER module_alias
is "acpi:INTABCD", but the uevent attribute of its platform device node
is "platform:INTABCD:00" (PREFIX:platform_device->name).
If this piece of code is used in an I2C driver for an ACPI enumerated
i2c device, the i2c driver module_alias is "acpi:INTABCD", but
the uevent of its i2c device node is
"i2c:INTABCD:00" (PREFIX:i2c_client->name).
If this piece of code is used in an *SPI* driver for an ACPI enumerated
spi device, the spi driver module_alias is "acpi:INTABCD", but
the uevent of its spi device node is
"spi:INTABCD" (PREFIX:spi_device->modalias).

thus when the device node is created, the driver will not be loaded
automatically because their modalias do not match.

> Please also always remember to CC maintainers on patches.
> 
okay, will resend the patches later.

thanks,
rui
> > diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> > index 349ebba..ab70eda 100644
> > --- a/drivers/spi/spi.c
> > +++ b/drivers/spi/spi.c
> > @@ -58,6 +58,11 @@ static ssize_t
> >  modalias_show(struct device *dev, struct device_attribute *a, char *buf)
> >  {
> >  	const struct spi_device	*spi = to_spi_device(dev);
> > +	int len;
> > +
> > +	len = acpi_device_modalias(dev, buf, PAGE_SIZE);
> > +	if (len != -ENODEV)
> > +		return len;
> >  
> >  	return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias);
> >  }
> 
> What does this do and why can't acpi_driver_match_device() handle this
> like it does for other ACPI devices?  We don't need to add such code for
> other firmware interfaces...

  parent reply	other threads:[~2014-01-14  8:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 13:48 [PATCH 3/4] fix module autoloading for ACPI enumerated devices Zhang Rui
     [not found] ` <1389620911-3890-1-git-send-email-rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-01-13 17:35   ` Mark Brown
     [not found]     ` <20140113173525.GF29039-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-01-14  8:00       ` Zhang Rui [this message]
2014-01-14 14:41         ` Mark Brown
2014-01-15  1:16           ` Zhang Rui
  -- strict thread matches above, loose matches on Subject: below --
2014-01-14  8:46 [PATCH 0/4] module autoloading fixes Zhang Rui
     [not found] ` <1389689198-2641-1-git-send-email-rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-01-14  8:46   ` [PATCH 3/4] fix module autoloading for ACPI enumerated devices Zhang Rui
2014-01-15 15:08     ` Mika Westerberg
     [not found]       ` <20140115150834.GX2494-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-01-16  8:04         ` Zhang Rui
2014-01-17  1:28           ` Rafael J. Wysocki
     [not found]             ` <3559262.qTvGllE4Ix-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2014-01-17  1:56               ` Zhang Rui
2014-01-16 12:27     ` Wolfram Sang
2014-01-16 13:05       ` Zhang Rui
2014-01-16 19:46         ` Mark Brown
2014-01-17  7:37           ` Jarkko Nikula
     [not found]             ` <52D8DDD4.10704-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-01-17 15:57               ` Mark Brown
2014-01-20  7:10                 ` Jarkko Nikula
     [not found]     ` <1389689198-2641-4-git-send-email-rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-01-16 12:28       ` Mark Brown
     [not found]         ` <20140116122819.GO15567-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-01-16 12:51           ` Zhang Rui
2014-01-16 19:24           ` Wolfram Sang

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=1389686417.3309.8.camel@rzhang1-mobl4 \
    --to=rui.zhang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).