* [PATCH] drivers/block/xsysace - revert "id" type from "u32" back to "int"
@ 2013-02-07 13:05 Alexey Brodkin
0 siblings, 0 replies; only message in thread
From: Alexey Brodkin @ 2013-02-07 13:05 UTC (permalink / raw)
To: linux-kernel; +Cc: grant.likely, Vineet.Gupta1, arnd, Alexey Brodkin
On addition of new device specified in devicetree device's "id" is set
by default to "-1" (it's in "of_device_add").
During probing of xsysace itself driver wants to determine his instance
number (used later for example for device naming). It is done simply by
reading "dev->id" (which is "-1" by default).
Then driver tries to get "id" from devicetree description reading
specific "port-number" property with "of_property_read_u32". And if no
property "port-number" was found "id" won't be changed (so if it was
"-1" it remains the same).
And later we check it with "if (id < 0) id = 0;" to escape negative
values.
But if "id" is "u32" it's always > 0 and later this value "-1" is used
for example for generation of device name. And instead of "xsa" it will
be "xs'" (ASCII "'" is "a" - 1). Which I believe is not expected.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
drivers/block/xsysace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 1f38643..32cc0a1 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1154,7 +1154,7 @@ static int ace_probe(struct platform_device *dev)
{
resource_size_t physaddr = 0;
int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */
- u32 id = dev->id;
+ int id = dev->id;
int irq = 0;
int i;
--
1.7.10.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-02-07 13:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 13:05 [PATCH] drivers/block/xsysace - revert "id" type from "u32" back to "int" Alexey Brodkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®