From: Wolfram Sang <wsa@the-dreams.de>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Neelesh Gupta <neelegup@linux.vnet.ibm.com>,
linuxppc-dev@ozlabs.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: Driver to expose PowerNV platform i2c busses
Date: Thu, 13 Nov 2014 14:10:14 +0100 [thread overview]
Message-ID: <20141113131014.GA8025@katana> (raw)
In-Reply-To: <1415876169.666.2.camel@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 2491 bytes --]
> > Please sort the includes.
>
> Ugh ? Since when do we do that ? :-)
Since I realised it is more readable and reduces likeliness of
duplicated includes.
> > > + rc = opal_i2c_request(token, bus_id, req);
> > > + if (rc != OPAL_ASYNC_COMPLETION) {
> > > + rc = -EIO;
> > > + goto exit;
> > > + }
> > > +
> > > + rc = opal_async_wait_response(token, &msg);
> > > + if (rc) {
> > > + rc = -EIO;
> > > + goto exit;
> >
> > Is it really -EIO? Maybe -ETIMEDOUT?
>
> No, there is no timeout, if that fails something went quite wrong, it
> could almost be a BUG_ON (basically we passed a wrong token or a NULL
> msg).
OK. I'd think it at least makes sense to use error codes which
distinguish I2C bus errors from OPAL interface errors. Always using -EIO
seems very generic :)
> > I don't think you should offer I2C_FUNC_I2C with those limitations. Is
> > there a case you really needs this?
>
> Yes there is, and it's pretty common :-) I actually added this to
> Neelesh original driver, it's the "smbus" style but with 2 bytes offset.
> Typically what we need for driver such as at24. They use normal raw i2c
> writes for writes but need the 2-bytes write + read combo without stop
> for reads.
Understood. So, basically something like I2C_SMBUS_WORD_I2C_BLOCK_DATA
is missing where the 'command' argument is not u8 but u16? Brainstorming
here, not relevant for this driver now.
> > > + adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
> >
> > devm_kzalloc?
>
> Ah, I never got the knack of using the new devm stuff, Neelesh, can you
> take care of this ?
New? :D This would be a dead simple exercise to learn about it ;)
>
> > > + adapter->dev.parent = &pdev->dev;
> > > + adapter->dev.of_node = of_node_get(pdev->dev.of_node);
> > > + pname = of_get_property(pdev->dev.of_node, "port-name", NULL);
> >
> > I have never seen this binding before, it looks fishy. Where is it documented?
>
> We made it up, like pretty every SoC vendor out there. What's fishy
> about it ? It's a very good way to get fixed i2c port names on the
> system, the firmware defines them.
But the SoC vendors prefix it with their company name and add
documentation for the binding.
Furthermore, this is just wrong, too. The adapter name is the name of
the IP core or chip or whatever which does the I2C bus. It is not the
functional name of the bus. It should be plain "Opal I2C" or similar.
Regards,
Wolfram
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-11-13 13:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-10 6:05 [PATCH] i2c: Driver to expose PowerNV platform i2c busses Neelesh Gupta
2014-11-12 6:07 ` Benjamin Herrenschmidt
2014-11-13 5:36 ` Michael Ellerman
2014-11-13 7:58 ` Wolfram Sang
2014-11-13 10:56 ` Benjamin Herrenschmidt
2014-11-13 12:40 ` Benjamin Herrenschmidt
2014-11-13 18:08 ` Neelesh Gupta
2014-11-13 13:10 ` Wolfram Sang [this message]
2014-11-13 20:53 ` Benjamin Herrenschmidt
2014-11-14 5:17 ` Benjamin Herrenschmidt
2014-11-14 16:10 ` Neelesh Gupta
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=20141113131014.GA8025@katana \
--to=wsa@the-dreams.de \
--cc=benh@kernel.crashing.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=neelegup@linux.vnet.ibm.com \
/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).