From: Nicolas Pitre <nico@fluxnic.net>
To: Parshuram Thombare <pthombar@cadence.com>
Cc: mparab@cadence.com, alexandre.belloni@bootlin.com,
praneeth@ti.com, linux-kernel@vger.kernel.org,
vitor.soares@synopsys.com, slongerbeam@gmail.com,
linux-i3c@lists.infradead.org
Subject: Re: [PATCH v10 2/7] i3c: master: use i3c_master_register only for main master
Date: Thu, 3 Dec 2020 23:24:05 -0500 (EST) [thread overview]
Message-ID: <2s3n7419-1nr9-8885-882o-7qrsos6qq6q@syhkavp.arg> (raw)
In-Reply-To: <1606717066-3785-1-git-send-email-pthombar@cadence.com>
On Mon, 30 Nov 2020, Parshuram Thombare wrote:
> Removed last argument 'secondary' and restructured i3c_master_register
> to move code that can be common to i3c_secondary_master_register
> to separate function i3c_master_init.
>
> Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
[...]
> +static int i3c_master_init(struct i3c_master_controller *master,
> + struct device *parent,
> + const struct i3c_master_controller_ops *ops,
> + bool secondary)
> {
> unsigned long i2c_scl_rate = I3C_BUS_I2C_FM_PLUS_SCL_RATE;
> struct i3c_bus *i3cbus = i3c_master_get_bus(master);
> @@ -2535,10 +2514,49 @@ int i3c_master_register(struct i3c_master_controller *master,
> goto err_put_dev;
> }
>
> - ret = i3c_master_bus_init(master);
> + ret = i3c_primary_master_bus_init(master);
> if (ret)
> goto err_destroy_wq;
>
> + return 0;
> +
> +err_destroy_wq:
> + destroy_workqueue(master->wq);
> +
> +err_put_dev:
> + put_device(&master->dev);
> +
> + return ret;
> +}
[...]
> +int i3c_primary_master_register(struct i3c_master_controller *master,
> + struct device *parent,
> + const struct i3c_master_controller_ops *ops)
> +{
> + int ret;
> +
> + ret = i3c_master_init(master, parent, ops, false);
> + if (ret)
> + return ret;
> +
> ret = device_add(&master->dev);
> if (ret)
> goto err_cleanup_bus;
> @@ -2568,15 +2586,13 @@ int i3c_master_register(struct i3c_master_controller *master,
> err_cleanup_bus:
> i3c_master_bus_cleanup(master);
>
> -err_destroy_wq:
> destroy_workqueue(master->wq);
>
> -err_put_dev:
> put_device(&master->dev);
>
> return ret;
> }
This looks a bit confusing. Here you're rolling back detailss in
i3c_primary_master_register() that were factored out in
i3c_master_init(). If i3c_master_init() is successful, then you
shouldn't be undoing its things openly in i3c_primary_master_register().
Instead, there should be another function that does the reverse of
i3c_master_init() here.
Nicolas
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2020-12-04 4:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 6:16 [PATCH v10 0/7] I3C mastership handover support Parshuram Thombare
2020-11-30 6:16 ` [PATCH v10 1/7] i3c: master: master initialization flow document Parshuram Thombare
2020-11-30 6:17 ` [PATCH v10 2/7] i3c: master: use i3c_master_register only for main master Parshuram Thombare
2020-12-04 4:24 ` Nicolas Pitre [this message]
2020-12-08 5:47 ` Parshuram Raju Thombare
2021-06-08 23:21 ` Alexandre Belloni
2021-06-17 8:42 ` Parshuram Raju Thombare
2020-11-30 6:18 ` [PATCH v10 3/7] i3c: master: add i3c_secondary_master_register Parshuram Thombare
2020-12-04 4:42 ` Nicolas Pitre
2020-12-08 6:00 ` Parshuram Raju Thombare
2020-11-30 6:18 ` [PATCH v10 4/7] i3c: master: add mastership handover support Parshuram Thombare
2020-11-30 6:19 ` [PATCH v10 5/7] i3c: master: add defslvs processing Parshuram Thombare
2020-11-30 6:20 ` [PATCH v10 6/7] i3c: master: sysfs key for acquire bus Parshuram Thombare
2021-06-08 23:33 ` Alexandre Belloni
2021-06-17 9:13 ` Parshuram Raju Thombare
2020-11-30 6:20 ` [PATCH v10 7/7] i3c: master: mastership handover, defslvs processing in cdns controller driver Parshuram Thombare
2021-06-08 23:47 ` Alexandre Belloni
2021-06-17 10:28 ` Parshuram Raju Thombare
2021-03-04 10:06 ` [PATCH v10 0/7] I3C mastership handover support Parshuram Raju Thombare
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=2s3n7419-1nr9-8885-882o-7qrsos6qq6q@syhkavp.arg \
--to=nico@fluxnic.net \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mparab@cadence.com \
--cc=praneeth@ti.com \
--cc=pthombar@cadence.com \
--cc=slongerbeam@gmail.com \
--cc=vitor.soares@synopsys.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).