devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Opensource [Adam Thomson]"
	<Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	"linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Dmitry Eremin-Solenikov
	<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Support Opensource
	<Support.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH 1/8] mfd: Add support for DA9150 combined charger & fuel-gauge device
Date: Sat, 21 Jun 2014 12:38:37 +0100	[thread overview]
Message-ID: <53A56EBD.5040407@kernel.org> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A0337AB4FD95E-68WUHU125fLLPO1uwJ3ImwLouzNaz+3S@public.gmane.org>

On 16/06/14 14:12, Opensource [Adam Thomson] wrote:
> On Sun, Jun 15, 2014 at 20:49, Jonathan Cameron wrote:
>
>> Hi Adam,
>>
>> Some general comments inline.
>>
>> It's been a while since I've looked at any particularly similar parts,
>> but it seems to me that a lot of indirection gets added here that
>> if anything makes the codes slightly harder to follow...
>>
>> Feel free to disagree with me though!
>
> Will do :)
>
>> To my mind all these wrappers add nothing significant so you might as well
>> just call da9150->read_dev etc directly.
>>
>> Also, what are the read_qif and write_qif for?  They don't seem to be used
>> anywhere.
>
> read_qif and write_qif are for the Fuel-Gauge functionality of the chip. The
> associated driver will be submitted after acceptance of initial driver code,
> and will make use of these functions.
Ideally drop these for now and bring them in as a precursor patch in the series
that introduces them being used.
>
> The wrappers automatically choose the correct client to use (QIF uses a
> different slave address to the main chip one). Means the child drivers only need
> to pass through the da9150 struct and the rest is dealt with underneath.
>
>> The only real reason I can see for these wrappers is because you want
>> to hide the struct da9150 contents from the children of the mfd. As you
>> aren't doing that, you might as well drop these in favour of direct
>> calls to regmap_read and friends.
>
> As I have a need to pass through the main da9150 struct point for the
> aforementioned wrappers, it seemed cleaner and more consistent to have wrappers
> for these as well, which did the job of regmap access. Means all HW access
> uses the same kind of approach, and all sub-devices just need a point to the
> main da9150 struct to be able to use the functions.
>
>> I'll continue my tirade against obvious comments. Wrong format and
>> adds nothing to what is here as init and exit functions are clearly
>> doing what their name suggests (it's one of my pet hates ;)
>
> I agree the comment doesn't add much in terms of description but for me it
> breaks up the code to make it easier to follow.
They really don't make it significantly easier to follow and after a few
cycles of the driver being patched with new stuff etc, they tend to become
actively misleading.
>However if I get an overwhelming
> hatred for this I can change it. Also, I know the rule regarding single/multiple
> line comments but here again I feel it helps separate the code and makes it
> easier to read.
I'll leave it up to the other maintainers to say they don't mind.  But for IIO
please keep strictly to the style (including all the unwritten bits ;)

>
>> As a general good practice point, I'd rather that the driver supported
>> more than one instance of the chip.. Hence you'd take a copy of da9150_devs
>> to use here.  I guess it is relatively unlikely with one of these, but
>> you never know ;)
>
> Have followed the general methods for MFD here, and a number of drivers take the
> same approach. Also, I think it would be undesirable to have multiple charger
> chips of the same type in one platform. I agree generally it's best to support
> multiple instances, but here I don't think we should.
You are a brave man to tell your customers what to do.  If some crazy person
does use multiple of these chips on a device you get to deal with the inevitable
question of why doesn't it work ;)
>
>> Why does this need it's own file?  Does the DA9150 support any other
>> interfaces?
>
> Yes, the DA9150 also has a SPI interface. At present the plan is to just add I2C
> support for now, but in the future we may add SPI support, so have written the
> code with this in mind.
Ah, I didn't find that from the details I could find via google.  In that
case fair enough.
>
>> Why the indirection?  The da9150 only supports i2c as far as I can see.
>
> As per my last comment.
>
>> I'd roll this into one line and not bother with the local variable...
>
> Fair enough but I think this keeps the code cleaner, and to me it makes sense
> for the actual logic to be in core file as that's interface agnostic.
>
>> Drop comments on things that are self-evident.  Also these are one
>> line comments so should be using the single line comment syntax.
>
> As per my previous comment I think it just helps to break up the code and makes
> it more readable. Will change it though if the general consensus is to remove
> it.

  parent reply	other threads:[~2014-06-21 11:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 11:11 [PATCH 0/8] Add initial support for DA9150 Charger & Fuel-Gauge IC Adam Thomson
2014-06-11 11:11 ` [PATCH 1/8] mfd: Add support for DA9150 combined charger & fuel-gauge device Adam Thomson
     [not found]   ` <bf472aa7fddd1e67a3d5b9024b5b621744146a27.1402484954.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-06-15 19:49     ` Jonathan Cameron
     [not found]       ` <539DF8C6.8030009-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-16 13:12         ` Opensource [Adam Thomson]
     [not found]           ` <2E89032DDAA8B9408CB92943514A0337AB4FD95E-68WUHU125fLLPO1uwJ3ImwLouzNaz+3S@public.gmane.org>
2014-06-16 20:13             ` Jonathan Cameron
2014-06-21 11:38             ` Jonathan Cameron [this message]
2014-06-11 11:11 ` [PATCH 2/8] mfd: da9150: Add DT binding documentation for core Adam Thomson
2014-06-11 11:11 ` [PATCH 4/8] iio: Add support for DA9150 GPADC Adam Thomson
     [not found]   ` <3c1a7551c7deaeccdca731fa95f4349c57e04249.1402484954.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-06-11 16:34     ` Jonathan Cameron
2014-06-11 16:56       ` Opensource [Adam Thomson]
     [not found]         ` <2E89032DDAA8B9408CB92943514A0337A56F5455-68WUHU125fLLPO1uwJ3ImwLouzNaz+3S@public.gmane.org>
2014-06-15 19:55           ` Jonathan Cameron
2014-06-15 20:19     ` Jonathan Cameron
     [not found]       ` <539DFFC8.3080406-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-16 15:58         ` Opensource [Adam Thomson]
     [not found]           ` <2E89032DDAA8B9408CB92943514A0337AB4FD9C7-68WUHU125fLLPO1uwJ3ImwLouzNaz+3S@public.gmane.org>
2014-06-21 11:29             ` Jonathan Cameron
2014-06-11 11:11 ` [PATCH 5/8] iio: da9150: Add DT binding documentation for GPADC Adam Thomson
     [not found] ` <cover.1402484954.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-06-11 11:11   ` [PATCH 3/8] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Adam Thomson
     [not found]     ` <0e7c03b0467ae1eace9dafebe6946d01d48e72f2.1402484954.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-06-15 20:20       ` Jonathan Cameron
     [not found]         ` <539E0001.60005-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-21 11:32           ` Jonathan Cameron
2014-06-11 11:11   ` [PATCH 6/8] power: Add support for DA9150 Charger Adam Thomson
     [not found]     ` <d4ef0d7ce2d6a2919d528ed75e82d2b99ec8d962.1402484954.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-06-16 13:27       ` Lee Jones
2014-06-17  8:21         ` Opensource [Adam Thomson]
2014-06-11 11:11   ` [PATCH 7/8] power: da9150: Add DT binding documentation for charger Adam Thomson
2014-06-11 11:11   ` [PATCH 8/8] DT: Add vendor prefix for Dialog Semiconductor Ltd Adam Thomson
     [not found]     ` <bf4b6d7b061e66d3ca7f3dd44319b9e26ae7103f.1402484954.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-06-11 12:09       ` Geert Uytterhoeven
2014-06-11 12:43         ` Rob Herring
     [not found]           ` <CAL_JsqK0RqYuZ8YB1sBZK7hMXvp6oEPfAu11m95F61_kGV3Ptg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-11 13:01             ` Geert Uytterhoeven
2014-06-11 13:17             ` Opensource [Adam Thomson]
     [not found]               ` <2E89032DDAA8B9408CB92943514A0337A56F53A6-68WUHU125fLLPO1uwJ3ImwLouzNaz+3S@public.gmane.org>
2014-06-11 14:22                 ` Rob Herring
2014-06-11 13:31           ` Adam Thomson
  -- strict thread matches above, loose matches on Subject: below --
2014-09-23 10:53 [PATCH v3 0/8] Add initial support for DA9150 Charger & Fuel-Gauge IC Adam Thomson
     [not found] ` <cover.1411396718.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-09-23 10:53   ` [PATCH 1/8] mfd: Add support for DA9150 combined charger & fuel-gauge device Adam Thomson
     [not found]     ` <8fd576055fd9e4f8c75cba06d6ebb13fea670920.1411396719.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-09-27 10:33       ` Jonathan Cameron

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=53A56EBD.5040407@kernel.org \
    --to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org \
    --cc=Support.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org \
    --cc=dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.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).