Re: [PATCH] [PNP] 'modalias' sysfs export

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kay Sievers <[email protected]> wrote:
>
> On Sun, Mar 12, 2006 at 12:17:19PM +0100, Pierre Ossman wrote:
> > Andrew Morton wrote:
> > > I assume you mean that the drivers/pnp/card.c patch of
> > > pnp-modalias-sysfs-export.patch needs to be removed and this patch applies
> > > on top of the result.
> > >
> > > But I don't want to break udev.
> > >   
> > 
> > I suppose I wasn't entirely clear there. I'd like you to do the first
> > part (remove the card.c part), but not apply this second patch. I just
> > sent that in as a means of getting the ball rolling again.
> 
> Again, multiline sysfs modalias files are not going to happen. Find a
> sane way to encode the list of devices into a single string, or don't do
> it at all. And it must be available in the event environment too.
> 
> > The reason I'm pushing this issue is that Red Hat decided to drop all
> > magical scripts that figured out what modules to load and instead only
> > use the modalias attribute. They consider the right way to go is to get
> > the PNP layer to export modalias, so that's what I'm trying to do.
> 
> There is no need to rush out with this half-baken solution. This simple
> udev rule does the job for you, if you want pnp module autoloading with
> the current kernel:
>   SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'"
> 
> Andrew, please make sure, that this patch does not hit mainline until
> there is a _sane_ solution to the multiple id's exported for a single
> device problem.
> 

The only patch I presently have is:

--- devel/drivers/pnp/interface.c~pnp-modalias-sysfs-export	2006-03-12 03:27:01.000000000 -0800
+++ devel-akpm/drivers/pnp/interface.c	2006-03-12 03:27:01.000000000 -0800
@@ -459,10 +459,22 @@ static ssize_t pnp_show_current_ids(stru
 
 static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL);
 
+static ssize_t pnp_modalias_show(struct device *dmdev, struct device_attribute *attr, char *buf)
+{
+	struct pnp_dev *dev = to_pnp_dev(dmdev);
+	struct pnp_id * pos = dev->id;
+
+	/* FIXME: modalias can only do one alias */
+	return sprintf(buf, "pnp:d%s\n", pos->id);
+}
+
+static DEVICE_ATTR(modalias,S_IRUGO,pnp_modalias_show,NULL);
+
 int pnp_interface_attach_device(struct pnp_dev *dev)
 {
 	device_create_file(&dev->dev,&dev_attr_options);
 	device_create_file(&dev->dev,&dev_attr_resources);
 	device_create_file(&dev->dev,&dev_attr_id);
+	device_create_file(&dev->dev,&dev_attr_modalias);
 	return 0;
 }
_

Is that OK?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux