From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Added i2c support for mc13xxx-core
Date: Wed, 8 Dec 2010 11:42:13 +0100 [thread overview]
Message-ID: <20101208104213.GL18244@pengutronix.de> (raw)
In-Reply-To: <201012081907.55980.marc@cpdesign.com.au>
Hello,
On Wed, Dec 08, 2010 at 07:07:55PM +1100, Marc Reilly wrote:
> Hi Yong,
>
> > It's better to use git format-patch to gernerate patch for review, by
> > which you can add some commit information and s-o-b stuff.
>
> I've submitted a (slightly) better patch earlier today. (although this was
> generated via format-patch, I forgot the sob.).
>
> My main hope was to get some indication that I was progressing along the right
> path.
>
> > Please see inline comments.
> Thanks, replies also in-line.
>
> snip...
>
> > > + if (usespi) {
> > > + const struct spi_device_id *devid =
> > > + spi_get_device_id(mc13xxx->spidev);
> > > + if (!devid || devid->driver_data !=
> > > mc13xxx->icid) + dev_warn(mc13xxx->pdev,
> > > "device id doesn't " +
> > > "match auto detection!\n"); + } else {
> > > + /* TODO */
> >
> > todo what? remove this or add real code here.
> >
>
> I wasn't immediately sure of what the equivalent way to do this via the i2c
> subsystem is. I'm not sure how useful it would be anyway, so I'll leave it out
> in future.
I think this is OK to post the patch with TODO for review if you don't
know what to do (maybe specify a question here, then though). For a
final patch that should be fixed of course.
>
> snip ...
>
> > > + mutex_init(&mc13xxx->lock);
> > > + mc13xxx_lock(mc13xxx);
> > > +
> > > + ret = mc13xxx_identify(mc13xxx, 0);
> > > + if (ret || (mc13xxx->icid == MC13XXX_ID_INVALID))
> > > + goto err_revision;
> > > +
> > > + /* mask all irqs */
> > > + ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK0, 0x00ffffff);
> > > + if (ret)
> > > + goto err_mask;
> > > +
> > > + ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK1, 0x00ffffff);
> > > + if (ret)
> > > + goto err_mask;
> > > +
> > > + ret = request_threaded_irq(mc13xxx->irq, NULL,
> > > mc13xxx_irq_thread, + IRQF_ONESHOT |
> > > IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx); +
> > > + if (ret) {
> > > +err_mask:
> >
> > > +err_revision:
> > Why two labels here?
>
> Copied from existing code.
I consider this to be OK, too (actually it's my code, so it would be
surprising if not ...) There are two different errors that just share
the place the goto should point to. Technically a single name would do
it, but I learned that for one the code is easier to verify with useful
label names and sometimes when code needs to be reshuffled the patch
becomes slightly less intrusive.
> > Also, if ret == 0, the lock will not be released.
>
> The lock is released in mc13xxx_common_probe.
> Yes, it would be better in this function, before common_probe is called.
ack
>
> >
> > > + mutex_unlock(&mc13xxx->lock);
> > > + kfree(mc13xxx);
> > > + return ret;
> > > + }
> > > +
> > > + return mc13xxx_common_probe(mc13xxx,pdata);
> > > +}
> > > +
> > > +static int __devexit mc13xxx_i2c_remove(struct i2c_client *client)
> > > +{
> > > + struct mc13xxx *mc13xxx = dev_get_drvdata(&client->dev);
> > > +
> > > + free_irq(mc13xxx->irq, mc13xxx);
> > > +
> > > + mfd_remove_devices(&client->dev);
> > > +
> > > + kfree(mc13xxx);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static const struct i2c_device_id mc13xxx_i2c_idtable[] = {
> > > + { "mc13892", MC13XXX_ID_MC13892},
> > > + { }
> >
> > you may want to remove empty '{}'
>
> Again, mimicking the existing spi device table.
This must not go away, as it's the sentinel to mark the end of the
array.
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2010-12-08 10:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 6:25 [PATCH] support PMIC mc13892 yong.shen at freescale.com
2010-12-06 7:22 ` Uwe Kleine-König
2010-12-07 2:41 ` Yong Shen
2010-12-07 7:57 ` Yong Shen
2010-12-07 8:02 ` Uwe Kleine-König
2010-12-06 10:40 ` David Jander
2010-12-07 2:50 ` Yong Shen
2010-12-06 10:55 ` Arnaud Patard (Rtp)
2010-12-06 11:42 ` Alberto Panizzo
2010-12-06 11:55 ` Arnaud Patard (Rtp)
2010-12-06 13:12 ` Alberto Panizzo
2010-12-07 2:52 ` Yong Shen
2010-12-06 21:54 ` Marc Reilly
2010-12-07 7:14 ` [PATCH] Added i2c support for mc13xxx-core Marc Reilly
2010-12-07 8:32 ` Yong Shen
2010-12-07 10:09 ` Marc Reilly
2010-12-08 6:24 ` Yong Shen
2010-12-08 8:07 ` Marc Reilly
2010-12-08 10:42 ` Uwe Kleine-König [this message]
2010-12-07 7:23 ` Marc Reilly
2010-12-07 7:23 ` Marc Reilly
[not found] <1291761693-29689-2-git-send-email-marc@cpdesign.com.au>
2010-12-07 22:52 ` Marc Reilly
2010-12-08 8:38 ` Uwe Kleine-König
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=20101208104213.GL18244@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).