All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: Wolfram Sang <wsa@the-dreams.de>
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: Sun, 17 Mar 2019 21:32:17 +0000	[thread overview]
Message-ID: <93ded6d5-1688-896a-f42e-0bbeda446c1d@axentia.se> (raw)
In-Reply-To: <20190316164308.GA1747@kunai>

On 2019-03-16 17:43, Wolfram Sang wrote:
> 
>> 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.

Ok, it's your call obviously, and doing a rename away from the _ptrerr
suffix when the old name is no longer in use is easier than changing
the return value convention. You just have to wait a couple of releases
so that stragglers that are slow to upstream don't get caught by the
changed semantics when it eventually happens. However, my point is that
these conversions tend to drag out, and in the meantime we are stuck
with whatever names we chose.

Perhaps add a rule to checkpatch to avoid new instances of the now
inferior i2c_new_{device,dummy}?

Anyway, what happens for the callers that ignore the return value of
these functions? Is that always a leak or are there cases when it is ok?
__must_check?? (not applicable for devm_... of course)

Cheers,
Peter

  reply	other threads:[~2019-03-17 21:32 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
2019-03-17 21:32       ` Peter Rosin [this message]
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=93ded6d5-1688-896a-f42e-0bbeda446c1d@axentia.se \
    --to=peda@axentia.se \
    --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=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /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.