All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Opensource [Adam Thomson]" <Adam.Thomson.Opensource@diasemi.com>,
	Lee Jones <lee.jones@linaro.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Support Opensource <Support.Opensource@diasemi.com>
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@SW-EX-MBX01.diasemi.com>

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.


WARNING: multiple messages have this Message-ID (diff)
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:36 UTC|newest]

Thread overview: 68+ 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 ` Adam Thomson
2014-06-11 11:11 ` [PATCH 1/8] mfd: Add support for DA9150 combined charger & fuel-gauge device Adam Thomson
2014-06-11 11:11   ` Adam Thomson
2014-06-15 19:49   ` Jonathan Cameron
2014-06-15 19:49     ` Jonathan Cameron
2014-06-16 13:12     ` Opensource [Adam Thomson]
2014-06-16 13:12       ` Opensource [Adam Thomson]
2014-06-16 13:12       ` Opensource [Adam Thomson]
2014-06-16 20:13       ` Jonathan Cameron
2014-06-16 20:13         ` Jonathan Cameron
2014-06-21 11:38       ` Jonathan Cameron [this message]
2014-06-21 11:38         ` Jonathan Cameron
2014-06-11 11:11 ` [PATCH 2/8] mfd: da9150: Add DT binding documentation for core Adam Thomson
2014-06-11 11:11   ` Adam Thomson
2014-06-11 11:11 ` [PATCH 3/8] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Adam Thomson
2014-06-11 11:11   ` Adam Thomson
2014-06-15 20:20   ` Jonathan Cameron
2014-06-15 20:20     ` Jonathan Cameron
2014-06-21 11:32     ` Jonathan Cameron
2014-06-21 11:32       ` Jonathan Cameron
2014-06-11 11:11 ` [PATCH 4/8] iio: Add support for DA9150 GPADC Adam Thomson
2014-06-11 11:11   ` Adam Thomson
2014-06-11 16:34   ` Jonathan Cameron
2014-06-11 16:34     ` Jonathan Cameron
2014-06-11 16:56     ` Opensource [Adam Thomson]
2014-06-11 16:56       ` Opensource [Adam Thomson]
2014-06-11 16:56       ` Opensource [Adam Thomson]
2014-06-15 19:55       ` Jonathan Cameron
2014-06-15 19:55         ` Jonathan Cameron
2014-06-15 20:19   ` Jonathan Cameron
2014-06-15 20:19     ` Jonathan Cameron
2014-06-16 15:58     ` Opensource [Adam Thomson]
2014-06-16 15:58       ` Opensource [Adam Thomson]
2014-06-16 15:58       ` Opensource [Adam Thomson]
2014-06-21 11:29       ` Jonathan Cameron
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
2014-06-11 11:11   ` Adam Thomson
2014-06-11 11:11 ` [PATCH 6/8] power: Add support for DA9150 Charger Adam Thomson
2014-06-11 11:11   ` Adam Thomson
2014-06-16 13:27   ` Lee Jones
2014-06-16 13:27     ` Lee Jones
2014-06-17  8:21     ` Opensource [Adam Thomson]
2014-06-17  8:21       ` Opensource [Adam Thomson]
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   ` Adam Thomson
2014-06-11 11:11 ` [PATCH 8/8] DT: Add vendor prefix for Dialog Semiconductor Ltd Adam Thomson
2014-06-11 11:11   ` Adam Thomson
2014-06-11 12:09   ` Geert Uytterhoeven
2014-06-11 12:09     ` Geert Uytterhoeven
2014-06-11 12:43     ` Rob Herring
2014-06-11 13:01       ` Geert Uytterhoeven
2014-06-11 13:01         ` Geert Uytterhoeven
2014-06-11 13:01         ` Geert Uytterhoeven
2014-06-11 13:17       ` Opensource [Adam Thomson]
2014-06-11 13:17         ` Opensource [Adam Thomson]
2014-06-11 13:17         ` Opensource [Adam Thomson]
2014-06-11 14:22         ` Rob Herring
2014-06-11 14:22           ` Rob Herring
2014-06-11 13:31       ` Adam Thomson
2014-06-11 13:31         ` Adam Thomson
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
2014-09-23 10:53     ` Adam Thomson
     [not found]     ` <8fd576055fd9e4f8c75cba06d6ebb13fea670920.1411396719.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
2014-09-27 10:33       ` Jonathan Cameron
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@kernel.org \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sameo@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.