From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Mårten Lindahl" <martenli@axis.com>
Cc: Cai Huoqing <cai.huoqing@linux.dev>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio@vger.kernel.org, kernel@axis.com
Subject: Re: [PATCH v2] iio: light: vcnl4000: Fix WARN_ON on uninitialized lock
Date: Tue, 31 Jan 2023 15:36:02 +0200 [thread overview]
Message-ID: <Y9kZQjYZfrkgHQBr@smile.fi.intel.com> (raw)
In-Reply-To: <d1ab0530-ef51-988b-f8b3-c69f6d3abb8e@axis.com>
On Tue, Jan 31, 2023 at 02:33:38PM +0100, Mårten Lindahl wrote:
> On 1/31/23 13:46, Cai Huoqing wrote:
> > On 31 1月 23 11:29:51, Mårten Lindahl wrote:
...
> > Why not add mutex_init(&data->vcnl4000_lock) in vcnl4200_init.
> > like this
> >
> > @@ -330,6 +330,7 @@ static int vcnl4200_init(struct vcnl4000_data *data)
> > }
> > mutex_init(&data->vcnl4200_al.lock);
> > mutex_init(&data->vcnl4200_ps.lock);
> > + mutex_init(&data->vcnl4000_lock);
> >
> > ret = data->chip_spec->set_power_state(data, true);
> > if (ret < 0)
> >
> > Perfer adding mutex_init to vcnl4200_init.
>
> Hi Cai!
>
> This is what I did in v1, but I got a suggestion to move it to the probe
> instead.
>
> Having it in probe takes one mutex_init. Otherwise it needs to be in two
> places (both init functions).
Exactly and if one more device will be added, we won't miss it, so it's less
error prone.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2023-01-31 13:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 10:29 [PATCH v2] iio: light: vcnl4000: Fix WARN_ON on uninitialized lock Mårten Lindahl
2023-01-31 12:33 ` Andy Shevchenko
2023-01-31 12:37 ` Andy Shevchenko
2023-01-31 13:27 ` Mårten Lindahl
2023-01-31 13:37 ` Andy Shevchenko
2023-01-31 13:42 ` Mårten Lindahl
2023-01-31 12:46 ` Cai Huoqing
2023-01-31 13:33 ` Mårten Lindahl
2023-01-31 13:36 ` Andy Shevchenko [this message]
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=Y9kZQjYZfrkgHQBr@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=cai.huoqing@linux.dev \
--cc=jic23@kernel.org \
--cc=kernel@axis.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=martenli@axis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox