From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-i2c@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, mst@redhat.com, wsa@kernel.org,
jasowang@redhat.com, wsa+renesas@sang-engineering.com,
andriy.shevchenko@linux.intel.com, conghui.chen@intel.com,
arnd@arndb.de, kblaiech@mellanox.com,
jarkko.nikula@linux.intel.com, Sergey.Semin@baikalelectronics.ru,
rppt@kernel.org, loic.poulain@linaro.org, tali.perry1@gmail.com,
u.kleine-koenig@pengutronix.de, bjorn.andersson@linaro.org,
yu1.wang@intel.com, shuo.a.liu@intel.com, stefanha@redhat.com,
pbonzini@redhat.com
Subject: Re: [PATCH v7] i2c: virtio: add a virtio i2c frontend driver
Date: Fri, 12 Mar 2021 15:51:13 +0800 [thread overview]
Message-ID: <a97c64ea-773a-133b-c37c-cd02493e0230@intel.com> (raw)
In-Reply-To: <20210312061012.slmfnhxe6y5kgrnv@vireshk-i7>
On 2021/3/12 14:10, Viresh Kumar wrote:
> I saw your email about wrong version being sent, I already wrote some
> reviews. Sending them anyway for FWIW :)
>
> On 12-03-21, 21:33, Jie Deng wrote:
>> +struct virtio_i2c {
>> + struct virtio_device *vdev;
>> + struct completion completion;
>> + struct i2c_adapter adap;
>> + struct mutex lock;
> As I said in the previous version (Yes, we were both waiting for
> Wolfram to answer that), this lock shouldn't be required at all.
>
> And since none of us have a use-case at hand where we will have a
> problem without this lock, we should really skip it. We can always
> come back and add it if we find an issue somewhere. Until then, better
> to keep it simple.
The problem is you can't guarantee that adap->algo->master_xfer
is only called from i2c_transfer. Any function who holds the adapter can
call
adap->algo->master_xfer directly. I prefer to avoid potential issues
rather than
find a issue then fix.
>
>> +
>> +static struct i2c_adapter virtio_adapter = {
>> + .owner = THIS_MODULE,
>> + .name = "Virtio I2C Adapter",
>> + .class = I2C_CLASS_DEPRECATED,
> What happened to this discussion ?
>
> https://lore.kernel.org/lkml/20210305072903.wtw645rukmqr5hx5@vireshk-i7/
My understanding is that new driver sets this to warn users that the
adapter doesn't support classes anymore.
I'm not sure if Wolfram can explain it more clear for you.
>
>> + .algo = &virtio_algorithm,
>> +
>> + return ret;
>> +
>> + vi->adap = virtio_adapter;
> This is strange, why are you allocating memory for adapter twice ?
> Once for virtio_adapter and once for vi->adap ? Either fill the fields
> directly for v->adap here and remove virtio_adapter or make vi->adap a
> pointer.
Will make vi->adap a pointer. Thanks.
WARNING: multiple messages have this Message-ID (diff)
From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: mst@redhat.com, bjorn.andersson@linaro.org,
wsa+renesas@sang-engineering.com, linux-i2c@vger.kernel.org,
wsa@kernel.org, andriy.shevchenko@linux.intel.com,
yu1.wang@intel.com, u.kleine-koenig@pengutronix.de,
kblaiech@mellanox.com, virtualization@lists.linux-foundation.org,
arnd@arndb.de, stefanha@redhat.com, tali.perry1@gmail.com,
conghui.chen@intel.com, loic.poulain@linaro.org,
linux-kernel@vger.kernel.org, Sergey.Semin@baikalelectronics.ru,
jarkko.nikula@linux.intel.com, shuo.a.liu@intel.com,
pbonzini@redhat.com, rppt@kernel.org
Subject: Re: [PATCH v7] i2c: virtio: add a virtio i2c frontend driver
Date: Fri, 12 Mar 2021 15:51:13 +0800 [thread overview]
Message-ID: <a97c64ea-773a-133b-c37c-cd02493e0230@intel.com> (raw)
In-Reply-To: <20210312061012.slmfnhxe6y5kgrnv@vireshk-i7>
On 2021/3/12 14:10, Viresh Kumar wrote:
> I saw your email about wrong version being sent, I already wrote some
> reviews. Sending them anyway for FWIW :)
>
> On 12-03-21, 21:33, Jie Deng wrote:
>> +struct virtio_i2c {
>> + struct virtio_device *vdev;
>> + struct completion completion;
>> + struct i2c_adapter adap;
>> + struct mutex lock;
> As I said in the previous version (Yes, we were both waiting for
> Wolfram to answer that), this lock shouldn't be required at all.
>
> And since none of us have a use-case at hand where we will have a
> problem without this lock, we should really skip it. We can always
> come back and add it if we find an issue somewhere. Until then, better
> to keep it simple.
The problem is you can't guarantee that adap->algo->master_xfer
is only called from i2c_transfer. Any function who holds the adapter can
call
adap->algo->master_xfer directly. I prefer to avoid potential issues
rather than
find a issue then fix.
>
>> +
>> +static struct i2c_adapter virtio_adapter = {
>> + .owner = THIS_MODULE,
>> + .name = "Virtio I2C Adapter",
>> + .class = I2C_CLASS_DEPRECATED,
> What happened to this discussion ?
>
> https://lore.kernel.org/lkml/20210305072903.wtw645rukmqr5hx5@vireshk-i7/
My understanding is that new driver sets this to warn users that the
adapter doesn't support classes anymore.
I'm not sure if Wolfram can explain it more clear for you.
>
>> + .algo = &virtio_algorithm,
>> +
>> + return ret;
>> +
>> + vi->adap = virtio_adapter;
> This is strange, why are you allocating memory for adapter twice ?
> Once for virtio_adapter and once for vi->adap ? Either fill the fields
> directly for v->adap here and remove virtio_adapter or make vi->adap a
> pointer.
Will make vi->adap a pointer. Thanks.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-03-12 7:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 13:33 [PATCH v7] i2c: virtio: add a virtio i2c frontend driver Jie Deng
2021-03-12 13:33 ` Jie Deng
2021-03-12 5:53 ` Jie Deng
2021-03-12 5:53 ` Jie Deng
2021-03-12 6:10 ` Viresh Kumar
2021-03-12 7:51 ` Jie Deng [this message]
2021-03-12 7:51 ` Jie Deng
2021-03-12 8:11 ` Viresh Kumar
2021-03-12 8:37 ` Jie Deng
2021-03-12 8:37 ` Jie Deng
2021-03-16 7:39 ` Viresh Kumar
2021-03-12 8:58 ` Arnd Bergmann
2021-03-12 8:58 ` Arnd Bergmann
2021-03-15 1:14 ` Jie Deng
2021-03-15 1:14 ` Jie Deng
2021-03-15 3:13 ` Jason Wang
2021-03-15 3:13 ` Jason Wang
2021-03-15 5:52 ` Jie Deng
2021-03-15 5:52 ` Jie Deng
2021-03-15 7:52 ` Arnd Bergmann
2021-03-15 7:52 ` Arnd Bergmann
2021-03-16 2:15 ` Jie Deng
2021-03-16 2:15 ` Jie Deng
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=a97c64ea-773a-133b-c37c-cd02493e0230@intel.com \
--to=jie.deng@intel.com \
--cc=Sergey.Semin@baikalelectronics.ru \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bjorn.andersson@linaro.org \
--cc=conghui.chen@intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=kblaiech@mellanox.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rppt@kernel.org \
--cc=shuo.a.liu@intel.com \
--cc=stefanha@redhat.com \
--cc=tali.perry1@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=viresh.kumar@linaro.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@kernel.org \
--cc=yu1.wang@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.