From: Sylvain Munaut <tnt@246tNt.com>
To: Paul Mackerras <paulus@samba.org>
Cc: PPC dev ML <linuxppc-dev@ozlabs.org>, Sylvain Munaut <tnt@246tNt.com>
Subject: [PATCH 3/8] macintosh: Use common modalias generation for macio_sysfs
Date: Sun, 6 May 2007 17:38:47 +0200 [thread overview]
Message-ID: <11784659368-git-send-email-tnt@246tNt.com> (raw)
In-Reply-To: <1178465935138-git-send-email-tnt@246tNt.com>
There is now a common function to generate the modalias string,
so use it. We just need to add the \n at the end.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
---
drivers/macintosh/macio_sysfs.c | 29 ++++++++---------------------
1 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index cc82679..d8fadc4 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -40,29 +40,16 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
char *buf)
-{
- struct of_device *of;
- const char *compat;
- int cplen;
- int length;
+{
+ struct of_device *ofdev = to_of_device(dev);
+ int len;
- of = &to_macio_device (dev)->ofdev;
- compat = of_get_property(of->node, "compatible", &cplen);
- if (!compat) compat = "", cplen = 1;
- length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
- buf += length;
- while (cplen > 0) {
- int l;
- l = sprintf (buf, "C%s", compat);
- length += l;
- buf += l;
- l = strlen (compat) + 1;
- compat += l;
- cplen -= l;
- }
- length += sprintf(buf, "\n");
+ len = of_device_get_modalias(ofdev, buf, PAGE_SIZE);
- return length;
+ buf[len] = '\n';
+ buf[len+1] = 0;
+
+ return len+1;
}
macio_config_of_attr (name, "%s\n");
--
1.5.1.2
next prev parent reply other threads:[~2007-05-06 15:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-06 15:38 macio modalias & mpc52xx related patches for 2.6.22 Sylvain Munaut
2007-05-06 15:38 ` [PATCH 1/8] powerpc: Fix the MODALIAS generation in modpost for of devices Sylvain Munaut
2007-05-06 15:38 ` [PATCH 2/8] powerpc: export of_device_get_modalias Sylvain Munaut
2007-05-06 15:38 ` Sylvain Munaut [this message]
2007-05-06 15:38 ` [PATCH 4/8] powerpc: lite5200(b) dts fixes Sylvain Munaut
2007-05-06 15:38 ` [PATCH 5/8] powerpc: lite5200(b) support for i2c Sylvain Munaut
2007-05-06 15:38 ` [PATCH 6/8] powerpc: Set efika's device_type to "soc" Sylvain Munaut
2007-05-06 15:38 ` [PATCH 7/8] serial/powerpc: Don't shutdown TX on mpc5200 serial port if it is a console Sylvain Munaut
2007-05-06 15:38 ` [PATCH 8/8] powerpc: mpc52xx suspend to deep-sleep Sylvain Munaut
2007-05-07 9:09 ` [PATCH 1/8] powerpc: Fix the MODALIAS generation in modpost for of devices Johannes Berg
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=11784659368-git-send-email-tnt@246tNt.com \
--to=tnt@246tnt.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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).