public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.14-rc4-git] s390, ccw - export modalias
@ 2005-10-12 19:26 Bastian Blank
  2005-10-12 19:59 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Bastian Blank @ 2005-10-12 19:26 UTC (permalink / raw)
  To: Martin Schwidefsky, torvalds, akpm; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

This patch exports modalias for ccw devices.

Signed-off-by: Bastian Blank <waldi@debian.org>

---

 drivers/s390/cio/device.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -252,6 +252,23 @@ cutype_show (struct device *dev, struct 
 }
 
 static ssize_t
+modalias_show (struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct ccw_device *cdev = to_ccwdev(dev);
+	struct ccw_device_id *id = &(cdev->id);
+	int ret;
+
+	ret = sprintf(buf, "ccw:t%04Xm%02x",
+			id->cu_type, id->cu_model);
+	if (id->dev_type != 0)
+		ret += sprintf(buf + ret, "dt%04Xdm%02X\n",
+				id->dev_type, id->dev_model);
+	else
+		ret += sprintf(buf + ret, "dtdm\n");
+	return ret;
+}
+
+static ssize_t
 online_show (struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct ccw_device *cdev = to_ccwdev(dev);
@@ -448,6 +465,7 @@ static DEVICE_ATTR(chpids, 0444, chpids_
 static DEVICE_ATTR(pimpampom, 0444, pimpampom_show, NULL);
 static DEVICE_ATTR(devtype, 0444, devtype_show, NULL);
 static DEVICE_ATTR(cutype, 0444, cutype_show, NULL);
+static DEVICE_ATTR(modalias, 0444, modalias_show, NULL);
 static DEVICE_ATTR(online, 0644, online_show, online_store);
 extern struct device_attribute dev_attr_cmb_enable;
 static DEVICE_ATTR(availability, 0444, available_show, NULL);
@@ -471,6 +489,7 @@ subchannel_add_files (struct device *dev
 static struct attribute * ccwdev_attrs[] = {
 	&dev_attr_devtype.attr,
 	&dev_attr_cutype.attr,
+	&dev_attr_modalias.attr,
 	&dev_attr_online.attr,
 	&dev_attr_cmb_enable.attr,
 	&dev_attr_availability.attr,

-- 
Spock: The odds of surviving another attack are 13562190123 to 1, Captain.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.14-rc4-git] s390, ccw - export modalias
  2005-10-12 19:26 [PATCH 2.6.14-rc4-git] s390, ccw - export modalias Bastian Blank
@ 2005-10-12 19:59 ` Andrew Morton
  2005-10-13  9:09   ` Martin Schwidefsky
  2005-10-14  4:20   ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2005-10-12 19:59 UTC (permalink / raw)
  To: Bastian Blank; +Cc: schwidefsky, torvalds, linux-kernel

Bastian Blank <bastian@waldi.eu.org> wrote:
>
> This patch exports modalias for ccw devices.

And why do we want to do that?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.14-rc4-git] s390, ccw - export modalias
  2005-10-12 19:59 ` Andrew Morton
@ 2005-10-13  9:09   ` Martin Schwidefsky
  2005-10-13 10:09     ` Bastian Blank
  2005-10-13 11:03     ` Bastian Blank
  2005-10-14  4:20   ` Greg KH
  1 sibling, 2 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2005-10-13  9:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Bastian Blank, torvalds, linux-kernel

On Wed, 2005-10-12 at 12:59 -0700, Andrew Morton wrote:
> Bastian Blank <bastian@waldi.eu.org> wrote:
> >
> > This patch exports modalias for ccw devices.
> 
> And why do we want to do that?

The wanted to have some information for use by udev. After looking at
the patch I wonder why they can't use the cutype/devtype attributes.
They already contain the information that gets exported by the new
attribute. It might be a little bit harder to parse because devtype can
be "n/a" but that certainly isn't rocket science.

-- 
blue skies,
   Martin

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.14-rc4-git] s390, ccw - export modalias
  2005-10-13  9:09   ` Martin Schwidefsky
@ 2005-10-13 10:09     ` Bastian Blank
  2005-10-13 11:03     ` Bastian Blank
  1 sibling, 0 replies; 6+ messages in thread
From: Bastian Blank @ 2005-10-13 10:09 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: Andrew Morton, torvalds, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

On Thu, Oct 13, 2005 at 11:09:38AM +0200, Martin Schwidefsky wrote:
> The wanted to have some information for use by udev. After looking at
> the patch I wonder why they can't use the cutype/devtype attributes.
> They already contain the information that gets exported by the new
> attribute. It might be a little bit harder to parse because devtype can
> be "n/a" but that certainly isn't rocket science.

The modalias entry is matched against the alias strings generated by
modpost and put into /lib/modules/$ver/modules.alias. This needs no
special knowledge about this sort of hardware.

Just take a look on how it is used by the pci and usb system.

Bastian

-- 
Where there's no emotion, there's no motive for violence.
		-- Spock, "Dagger of the Mind", stardate 2715.1

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.14-rc4-git] s390, ccw - export modalias
  2005-10-13  9:09   ` Martin Schwidefsky
  2005-10-13 10:09     ` Bastian Blank
@ 2005-10-13 11:03     ` Bastian Blank
  1 sibling, 0 replies; 6+ messages in thread
From: Bastian Blank @ 2005-10-13 11:03 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Thu, Oct 13, 2005 at 11:09:38AM +0200, Martin Schwidefsky wrote:
> The wanted to have some information for use by udev. After looking at
> the patch I wonder why they can't use the cutype/devtype attributes.

But anyway, one part is missing: The same string needs to be put in the
environment for hotplug as MODALIAS. And the n/a should be put as
dt0000dm00 in the string.

Bastian

-- 
There are always alternatives.
		-- Spock, "The Galileo Seven", stardate 2822.3

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.14-rc4-git] s390, ccw - export modalias
  2005-10-12 19:59 ` Andrew Morton
  2005-10-13  9:09   ` Martin Schwidefsky
@ 2005-10-14  4:20   ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2005-10-14  4:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Bastian Blank, schwidefsky, torvalds, linux-kernel

On Wed, Oct 12, 2005 at 12:59:39PM -0700, Andrew Morton wrote:
> Bastian Blank <bastian@waldi.eu.org> wrote:
> >
> > This patch exports modalias for ccw devices.
> 
> And why do we want to do that?

So you can do:
	modprobe `echo /sys/device/path_to_device/modalias`
and the proper driver will automatically be loaded by userspace.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-10-14  4:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-12 19:26 [PATCH 2.6.14-rc4-git] s390, ccw - export modalias Bastian Blank
2005-10-12 19:59 ` Andrew Morton
2005-10-13  9:09   ` Martin Schwidefsky
2005-10-13 10:09     ` Bastian Blank
2005-10-13 11:03     ` Bastian Blank
2005-10-14  4:20   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox