Re: [PATCH] Add sysfs support to the IPMI driver

From: Greg KH
Date: Mon Mar 14 2005 - 18:06:10 EST


On Sun, Mar 13, 2005 at 04:59:14PM -0600, Corey Minyard wrote:
> Greg KH wrote:
> >On Sat, Mar 12, 2005 at 10:57:24PM -0600, Corey Minyard wrote:
> >>The IPMI driver has long needed to tie into the device model (and I've
> >>long been hoping someone else would do it). I finally gave up and spent
> >>the time to learn how to do it. I think this is right, it seems to work
> >>on on my system.
> >
> >Looks good. One minor question:
> >
> >>+
> >>+ snprintf(name, sizeof(name), "ipmi%d", if_num);
> >>+ class_simple_device_add(ipmi_class, dev, NULL, name);
> >
> >What do ipmi class devices live on? pci devices? i2c devices?
> >platform devices? Or are they purely virtual things?
> >
> Good question. I struggled with this for a little while and decided the
> class interface was important to have in first and I'd figure out the
> rest later. They live in different places depending on the particular
> low-level interface. Some live on the I2C bus (and will show up there
> in sysfs with the I2C driver). Some live on the ISA bus, some are
> memory-mapped, some are on the PCI bus (though there is not a driver for
> PCI support yet), and some sit on the end of a serial port (driver is in
> the works). I know, it's a mess, but there's not much I can do about
> these crazy hardware manufacturers.
>
> I wasn't sure where to handle all this. The I2C and PCI bus side of
> things should be handled. However, the others probably need to sit
> someplace on a bus, right? That should probably be handled in the
> low-level code that actually knows where the hardware sits.

Well, how about handling the devices that already have a struct device
today (like the i2c and pci devices)? Pass the pointer to that device
into your class_simple_device_add() call. Then, work on figuring out
where your other devices live on some new bus later.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/