From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: <linux-kernel@vger.kernel.org>
Cc: <grant.likely@secretlab.ca>, <Vineet.Gupta1@synopsys.com>,
<arnd@arndb.de>, Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Subject: [PATCH] drivers/block/xsysace - revert "id" type from "u32" back to "int"
Date: Thu, 7 Feb 2013 17:05:31 +0400 [thread overview]
Message-ID: <1360242331-17025-1-git-send-email-abrodkin@synopsys.com> (raw)
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
reply other threads:[~2013-02-07 13:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1360242331-17025-1-git-send-email-abrodkin@synopsys.com \
--to=alexey.brodkin@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=arnd@arndb.de \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®