All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Peter Rosin <peda@axentia.se>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Kieran Bingham <kieran@ksquared.org.uk>
Subject: Re: [PATCH v7 2/3] i2c: core: add device-managed version of i2c_new_dummy
Date: Sat, 16 Mar 2019 17:43:08 +0100	[thread overview]
Message-ID: <20190316164308.GA1747@kunai> (raw)
In-Reply-To: <a3fd63fb-0eec-78f3-992f-84194bf571dd@axentia.se>


> I personally really dislike the proposed name. It is akin to the abomination
> where some sort of abbreviation of the types of variables are included also
> in the variable names. It's useless clutter, at least to me.

In general, I agree with you...

> I can see that you do not want to change the i2c_new_{device,dummy} names
> since they are kind of widespread and I can also see that you want to
> match the devm_ name with the non-devm_ name. So, I see *why* this naming
> is as it is, but I just don't like it.

... yet, there is another reason which is consistency. i2c_new_{device,dummy}
return NULL if something went wrong, and if the devm_* variants return
an ERRPTR, this is super confusing and error prone IMO. And the
difference between 'i2c_new_dummy' and 'i2c_register_dummy' doesn't make
that more clear, I think.

I would love to convert all of those functions to return an errptr at
some time. However, they are so widespread that this is difficult. I
actually had a look to convert the users with coccinelle, but handling
the error cases is so diverse that I don't think this is a way forward.

> I had a look at a couple of the i2c_new_dummy call sites, and some of them
> can be easily updated to simply pass on the PTRERR instead of hardcoding
> INVAL (or something) on NULL, some of them ignore the return value (and are
> thus not able to call i2c_unregister_device correctly) and some are

Those are likely prime candidates to convert to devm_*.

> different in other ways. In short, it seems that there are plenty of good
> opportunities to update lots of call sites to the new interfaces.

Yes. But it is quite some work, even more with i2c_new_device.

> However, after most of the maintained uses have been updated we are bound
> to have a tail of unmaintained code that will use the old interface. At
> some point, someone might convert the tail of call sites using the old
> NULL-returning functions. At that point we are stuck with a bunch of ugly
> hysterical foo_errptr names. And again it will be a daunting series to
> change them all at once.

OK, I can see that. If the longterm goal is to return errnos, then
it doesn't make sense to have it in the function name. This is valid
criticism. Yet, I still keep the other criticism from the first
paragraph where i2c_new_dummy and i2c_register_dummy is confusing.
Unless someone comes up with a solution we all overlooked, it will
probably be chosing the lesser evil.



  parent reply	other threads:[~2019-03-16 16:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 16:55 [PATCH v7 0/3] i2c: improve i2c_new_{device|dummy} Wolfram Sang
2019-03-13 16:55 ` [PATCH v7 1/3] i2c: core: improve return value handling of i2c_new_device and i2c_new_dummy Wolfram Sang
2019-03-15 11:57   ` Simon Horman
2019-03-15 12:15   ` Kieran Bingham
2019-03-13 16:55 ` [PATCH v7 2/3] i2c: core: add device-managed version of i2c_new_dummy Wolfram Sang
2019-03-14 10:25   ` Peter Rosin
2019-03-15 12:06     ` Kieran Bingham
2019-03-15 21:08       ` Wolfram Sang
2019-03-16  8:21         ` Peter Rosin
2019-03-16 16:44           ` Wolfram Sang
2019-03-16 16:43     ` Wolfram Sang [this message]
2019-03-17 21:32       ` Peter Rosin
2019-03-15 12:05   ` Simon Horman
2019-03-13 16:55 ` [PATCH v7 3/3] mfd: da9063: occupy second I2C address, too Wolfram Sang
2019-03-15 12:06   ` Simon Horman
2019-03-13 20:55 ` [PATCH v7 0/3] i2c: improve i2c_new_{device|dummy} Bartosz Golaszewski
2019-03-13 21:09   ` Wolfram Sang
2019-03-13 21:18     ` Bartosz Golaszewski
2019-03-13 21:19       ` Wolfram Sang
2019-03-14  8:51         ` Bartosz Golaszewski

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=20190316164308.GA1747@kunai \
    --to=wsa@the-dreams.de \
    --cc=brgl@bgdev.pl \
    --cc=hkallweit1@gmail.com \
    --cc=kieran@ksquared.org.uk \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=wsa+renesas@sang-engineering.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.