* [PATCH] create modalias file in sysfs for bus vio
@ 2008-01-22 8:33 Olaf Hering
2008-01-22 14:05 ` Stephen Rothwell
0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2008-01-22 8:33 UTC (permalink / raw)
To: linuxppc-dev
Create /sys/bus/vio/devices/*/modalias file to allow autoloading
of modules. modalias files are already present for many other bus types.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
arch/powerpc/kernel/vio.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -296,9 +296,24 @@ static ssize_t devspec_show(struct devic
return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
}
+static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct device_node *of_node = dev->archdata.of_node;
+ const char *compat;
+ int i = 0;
+
+ if (of_node) {
+ compat = of_get_property(of_node, "compatible", &i);
+ i = sprintf (buf, "vio:T%sS%s\n", of_node->type, compat ? compat : "");
+ }
+ return i;
+}
+
static struct device_attribute vio_dev_attrs[] = {
__ATTR_RO(name),
__ATTR_RO(devspec),
+ __ATTR_RO(modalias),
__ATTR_NULL
};
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] create modalias file in sysfs for bus vio
2008-01-22 8:33 [PATCH] create modalias file in sysfs for bus vio Olaf Hering
@ 2008-01-22 14:05 ` Stephen Rothwell
2008-01-25 17:09 ` Olaf Hering
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2008-01-22 14:05 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
Hi Olaf,
Thanks for this. Just a couple of nits ...
On Tue, 22 Jan 2008 09:33:28 +0100 Olaf Hering <olaf@aepfle.de> wrote:
>
> +static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
^
No space here, please.
> + char *buf)
> +{
> + struct device_node *of_node = dev->archdata.of_node;
> + const char *compat;
> + int i = 0;
> +
> + if (of_node) {
> + compat = of_get_property(of_node, "compatible", &i);
> + i = sprintf (buf, "vio:T%sS%s\n", of_node->type, compat ? compat : "");
^
Or here.
It would be nice if we could factor out the "vio:T%sS%s" string as it is
also used in vio_hotplug().
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] create modalias file in sysfs for bus vio
2008-01-22 14:05 ` Stephen Rothwell
@ 2008-01-25 17:09 ` Olaf Hering
2008-02-04 6:39 ` Stephen Rothwell
0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2008-01-25 17:09 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linuxppc-dev
On Wed, Jan 23, Stephen Rothwell wrote:
> It would be nice if we could factor out the "vio:T%sS%s" string as it is
> also used in vio_hotplug().
What exactly do you have in mind?
Creating a tempstring seems to make things more complicated.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] create modalias file in sysfs for bus vio
2008-01-25 17:09 ` Olaf Hering
@ 2008-02-04 6:39 ` Stephen Rothwell
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2008-02-04 6:39 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 677 bytes --]
Hi Olaf,
[Sorry, been on vacation]
On Fri, 25 Jan 2008 18:09:14 +0100 Olaf Hering <olaf@aepfle.de> wrote:
>
> On Wed, Jan 23, Stephen Rothwell wrote:
>
> > It would be nice if we could factor out the "vio:T%sS%s" string as it is
> > also used in vio_hotplug().
>
> What exactly do you have in mind?
> Creating a tempstring seems to make things more complicated.
Yeah, but it would be nice if the format only had to be known/changed in
one place. Don't worry about it for now. Or maybe create a "static const
char []" or #define with the string.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-04 6:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-22 8:33 [PATCH] create modalias file in sysfs for bus vio Olaf Hering
2008-01-22 14:05 ` Stephen Rothwell
2008-01-25 17:09 ` Olaf Hering
2008-02-04 6:39 ` Stephen Rothwell
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).