virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>, Arnd Bergmann <arnd@arndb.de>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Linux I2C" <linux-i2c@vger.kernel.org>,
	"Wolfram Sang" <wsa@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	yu1.wang@intel.com,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	kblaiech@mellanox.com, virtualization@lists.linux-foundation.org,
	"Enrico Weigelt, metux IT consult" <lkml@metux.net>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Tali Perry" <tali.perry1@gmail.com>,
	conghui.chen@intel.com, loic.poulain@linaro.org,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Sergey Semin" <Sergey.Semin@baikalelectronics.ru>,
	jarkko.nikula@linux.intel.com, shuo.a.liu@intel.com,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Mike Rapoport" <rppt@kernel.org>
Subject: Re: [PATCH v8] i2c: virtio: add a virtio i2c frontend driver
Date: Fri, 19 Mar 2021 13:31:34 +0800	[thread overview]
Message-ID: <b135b474-b167-67ad-588c-b0cfe8dc2998@intel.com> (raw)
In-Reply-To: <20210319035435.a4reve77hnvjdzwk@vireshk-i7>


On 2021/3/19 11:54, Viresh Kumar wrote:
> On 18-03-21, 15:52, Arnd Bergmann wrote:
>> Allowing multiple virtio-i2c controllers in one system, and multiple i2c
>> devices attached to each controller is clearly something that has to work.
> Good.
>
>> I don't actually see a limitation though. Viresh, what is the problem
>> you see for having multiple controllers?
> I thought this would be a problem in that case as we are using the global
> virtio_adapter here.
>
> +       vi->adap = &virtio_adapter;
> +       i2c_set_adapdata(vi->adap, vi);
>
> Multiple calls to probe() will end up updating the same pointer inside adap.
>
> +       vi->adap->dev.parent = &vdev->dev;
>
> Same here, overwrite.
>
> +       /* Setup ACPI node for controlled devices which will be probed through ACPI */
> +       ACPI_COMPANION_SET(&vi->adap->dev, ACPI_COMPANION(pdev));
> +       vi->adap->timeout = HZ / 10;
>
> These may be fine, but still not ideal I believe.
>
> +       ret = i2c_add_adapter(vi->adap);
> i
> This should be a problem as well, we must be adding this to some sort of list,
> doing some RPM stuff, etc ?
>
> Jie, the solution is to allocate memory for adap at runtime in probe and remove
> the virtio_adapter structure completely.


If you want to support that. Then I think we don't need to change the 
following at all.

> +    .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.


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-03-19  5:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 10:35 [PATCH v8] i2c: virtio: add a virtio i2c frontend driver Jie Deng
     [not found] ` <20210316074409.2afwsaeqxuwvj7bd@vireshk-i7>
     [not found]   ` <0dfff1ac-50bb-b5bc-72ea-880fd52ed60d@metux.net>
2021-03-18 14:52     ` Arnd Bergmann
     [not found]       ` <20210319035435.a4reve77hnvjdzwk@vireshk-i7>
2021-03-19  5:31         ` Jie Deng [this message]
     [not found]           ` <20210319054035.47tn747lkagpip6v@vireshk-i7>
2021-03-19  6:29             ` Jie Deng
     [not found]               ` <20210319063553.eq5aorcyiame6u2e@vireshk-i7>
2021-03-19  6:56                 ` Jie Deng
2021-03-19  8:27                 ` Arnd Bergmann
     [not found] ` <20210319055322.lw4dhb2kwtrtd3qu@vireshk-i7>
2021-03-19  7:52   ` 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=b135b474-b167-67ad-588c-b0cfe8dc2998@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=kblaiech@mellanox.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@metux.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).