* [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent()
@ 2007-02-17 2:56 ` Hoang-Nam Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Hoang-Nam Nguyen @ 2007-02-17 2:56 UTC (permalink / raw)
To: paulus, linuxppc-dev, linux-kernel, johnrose, Sylvain Munaut; +Cc: pmac, fenkes
This patch replaces ibmebus_uevent() by Sylvain's generic function.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
ibmebus.c | 37 +++----------------------------------
1 file changed, 3 insertions(+), 34 deletions(-)
diff -urp a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
--- a/arch/powerpc/kernel/ibmebus.c 2007-02-17 03:25:53.403375784 +0100
+++ b/arch/powerpc/kernel/ibmebus.c 2007-02-17 03:27:28.230336112 +0100
@@ -372,41 +372,10 @@ static int ibmebus_bus_match(struct devi
return 0;
}
-static int ibmebus_uevent(struct device *dev, char **envp, int num_envp,
- char *buffer, int buffer_size)
-{
- const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
- char *name, *cp, *loc_code;
- int length;
-
- if (!num_envp)
- return -ENOMEM;
-
- if (!ebus_dev->ofdev.node)
- return -ENODEV;
-
- name = (char *)get_property(ebus_dev->ofdev.node, "name", NULL);
- cp = (char *)get_property(ebus_dev->ofdev.node, "compatible", NULL);
- loc_code = (char *)get_property(ebus_dev->ofdev.node,
- "ibm,loc-code", NULL);
- if (!(name && cp && loc_code))
- return -ENODEV;
-
- envp[0] = buffer;
- length = scnprintf(buffer, buffer_size,
- "MODALIAS=ibmebus:T%s:S%s:L%s",
- name, cp, loc_code);
- if (buffer_size - length <= 0)
- return -ENOMEM;
- envp[1] = NULL;
-
- return 0;
-}
-
struct bus_type ibmebus_bus_type = {
- .name = "ibmebus",
- .uevent = ibmebus_uevent,
- .match = ibmebus_bus_match,
+ .name = "ibmebus",
+ .uevent = of_device_uevent,
+ .match = ibmebus_bus_match,
};
EXPORT_SYMBOL(ibmebus_bus_type);
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent()
@ 2007-02-17 2:56 ` Hoang-Nam Nguyen
0 siblings, 0 replies; 6+ messages in thread
From: Hoang-Nam Nguyen @ 2007-02-17 2:56 UTC (permalink / raw)
To: paulus, linuxppc-dev, linux-kernel, johnrose, Sylvain Munaut; +Cc: fenkes, pmac
This patch replaces ibmebus_uevent() by Sylvain's generic function.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
ibmebus.c | 37 +++----------------------------------
1 file changed, 3 insertions(+), 34 deletions(-)
diff -urp a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
--- a/arch/powerpc/kernel/ibmebus.c 2007-02-17 03:25:53.403375784 +0100
+++ b/arch/powerpc/kernel/ibmebus.c 2007-02-17 03:27:28.230336112 +0100
@@ -372,41 +372,10 @@ static int ibmebus_bus_match(struct devi
return 0;
}
-static int ibmebus_uevent(struct device *dev, char **envp, int num_envp,
- char *buffer, int buffer_size)
-{
- const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
- char *name, *cp, *loc_code;
- int length;
-
- if (!num_envp)
- return -ENOMEM;
-
- if (!ebus_dev->ofdev.node)
- return -ENODEV;
-
- name = (char *)get_property(ebus_dev->ofdev.node, "name", NULL);
- cp = (char *)get_property(ebus_dev->ofdev.node, "compatible", NULL);
- loc_code = (char *)get_property(ebus_dev->ofdev.node,
- "ibm,loc-code", NULL);
- if (!(name && cp && loc_code))
- return -ENODEV;
-
- envp[0] = buffer;
- length = scnprintf(buffer, buffer_size,
- "MODALIAS=ibmebus:T%s:S%s:L%s",
- name, cp, loc_code);
- if (buffer_size - length <= 0)
- return -ENOMEM;
- envp[1] = NULL;
-
- return 0;
-}
-
struct bus_type ibmebus_bus_type = {
- .name = "ibmebus",
- .uevent = ibmebus_uevent,
- .match = ibmebus_bus_match,
+ .name = "ibmebus",
+ .uevent = of_device_uevent,
+ .match = ibmebus_bus_match,
};
EXPORT_SYMBOL(ibmebus_bus_type);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent()
2007-02-17 2:56 ` Hoang-Nam Nguyen
@ 2007-02-17 9:36 ` Sylvain Munaut
-1 siblings, 0 replies; 6+ messages in thread
From: Sylvain Munaut @ 2007-02-17 9:36 UTC (permalink / raw)
To: Hoang-Nam Nguyen
Cc: paulus, linuxppc-dev, linux-kernel, johnrose, pmac, fenkes
Hoang-Nam Nguyen wrote:
> This patch replaces ibmebus_uevent() by Sylvain's generic function.
>
> struct bus_type ibmebus_bus_type = {
> - .name = "ibmebus",
> - .uevent = ibmebus_uevent,
> - .match = ibmebus_bus_match,
> + .name = "ibmebus",
> + .uevent = of_device_uevent,
> + .match = ibmebus_bus_match,
> };
> EXPORT_SYMBOL(ibmebus_bus_type);
>
Doesn't that oops when called with the fake parent device ?
Either you do a wrapper that test for it (that's what I did when I
posted the patch).
Or, an even better approach is to add this
+ if (!ebus_dev->ofdev.node)
+ return -ENODEV;
inside the code of of_device_uevent itself.
Sylvain
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent()
@ 2007-02-17 9:36 ` Sylvain Munaut
0 siblings, 0 replies; 6+ messages in thread
From: Sylvain Munaut @ 2007-02-17 9:36 UTC (permalink / raw)
To: Hoang-Nam Nguyen
Cc: pmac, fenkes, linux-kernel, linuxppc-dev, paulus, johnrose
Hoang-Nam Nguyen wrote:
> This patch replaces ibmebus_uevent() by Sylvain's generic function.
>
> struct bus_type ibmebus_bus_type = {
> - .name = "ibmebus",
> - .uevent = ibmebus_uevent,
> - .match = ibmebus_bus_match,
> + .name = "ibmebus",
> + .uevent = of_device_uevent,
> + .match = ibmebus_bus_match,
> };
> EXPORT_SYMBOL(ibmebus_bus_type);
>
Doesn't that oops when called with the fake parent device ?
Either you do a wrapper that test for it (that's what I did when I
posted the patch).
Or, an even better approach is to add this
+ if (!ebus_dev->ofdev.node)
+ return -ENODEV;
inside the code of of_device_uevent itself.
Sylvain
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent()
2007-02-17 9:36 ` Sylvain Munaut
@ 2007-02-17 15:53 ` Joachim Fenkes
-1 siblings, 0 replies; 6+ messages in thread
From: Joachim Fenkes @ 2007-02-17 15:53 UTC (permalink / raw)
To: Sylvain Munaut
Cc: Hoang-Nam Nguyen, johnrose, linux-kernel, linuxppc-dev, paulus, pmac
Sylvain Munaut <tnt@246tNt.com> wrote on 17.02.2007 04:36:01:
> Doesn't that oops when called with the fake parent device ?
I should stop posting patches after 12 hours of work ,)
> Or, an even better approach is to add this
>
> + if (!ebus_dev->ofdev.node)
> + return -ENODEV;
>
> inside the code of of_device_uevent itself.
Nice! Patch will follow.
Thanks again,
Joachim
---
Joachim Fenkes -- eHCA Linux Driver Developer and Hardware Tamer
extraordinaire
IBM Deutschland Entwicklung GmbH -- Dept. 3627 (I/O Firmware Development
2)
Schoenaicher Strasse 220 -- 71032 Boeblingen -- Germany
eMail: fenkes@de.ibm.com -- Phone: +49 7031 16 1239
Vorsitzender des Aufsichtsrats: Johann Weihen -- Geschäftsführung:
Herbert Kircher
Sitz der Gesellschaft: Böblingen -- Registergericht: Amtsgericht
Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent()
@ 2007-02-17 15:53 ` Joachim Fenkes
0 siblings, 0 replies; 6+ messages in thread
From: Joachim Fenkes @ 2007-02-17 15:53 UTC (permalink / raw)
To: Sylvain Munaut
Cc: pmac, linux-kernel, linuxppc-dev, paulus, Hoang-Nam Nguyen, johnrose
Sylvain Munaut <tnt@246tNt.com> wrote on 17.02.2007 04:36:01:
> Doesn't that oops when called with the fake parent device ?
I should stop posting patches after 12 hours of work ,)
> Or, an even better approach is to add this
>=20
> + if (!ebus=5Fdev->ofdev.node)
> + return -ENODEV;
>=20
> inside the code of of=5Fdevice=5Fuevent itself.
Nice! Patch will follow.
Thanks again,
Joachim
---
Joachim Fenkes -- eHCA Linux Driver Developer and Hardware Tamer=20
extraordinaire
IBM Deutschland Entwicklung GmbH -- Dept. 3627 (I/O Firmware Development =
2)
Schoenaicher Strasse 220 -- 71032 Boeblingen -- Germany
eMail: fenkes@de.ibm.com -- Phone: +49 7031 16 1239=20
Vorsitzender des Aufsichtsrats: Johann Weihen -- Gesch=E4ftsf=FChrung:=20
Herbert Kircher
Sitz der Gesellschaft: B=F6blingen -- Registergericht: Amtsgericht=20
Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-02-17 15:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-17 2:56 [PATCH 2.6.21-rc1] ibmebus: Use of_device_uevent() Hoang-Nam Nguyen
2007-02-17 2:56 ` Hoang-Nam Nguyen
2007-02-17 9:36 ` Sylvain Munaut
2007-02-17 9:36 ` Sylvain Munaut
2007-02-17 15:53 ` Joachim Fenkes
2007-02-17 15:53 ` Joachim Fenkes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.