From: Greg KH <gregkh@linuxfoundation.org>
To: Abhijit Gangurde <abhijit.gangurde@amd.com>
Cc: masahiroy@kernel.org, linux-kernel@vger.kernel.org,
michal.simek@amd.com, git@amd.com, nikhil.agarwal@amd.com,
Nipun.Gupta@amd.com
Subject: Re: [PATCH v2 1/4] cdx: Introduce lock to protect controller ops and controller list
Date: Mon, 31 Jul 2023 14:24:37 +0200 [thread overview]
Message-ID: <2023073148-carried-unshaved-77e4@gregkh> (raw)
In-Reply-To: <20230731120813.123247-2-abhijit.gangurde@amd.com>
On Mon, Jul 31, 2023 at 05:38:10PM +0530, Abhijit Gangurde wrote:
> Add a mutex lock to prevent race between controller ops initiated by
> the bus subsystem and the controller registration/unregistration.
>
> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
> ---
> drivers/cdx/cdx.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
> index d2cad4c670a0..66797c8fe400 100644
> --- a/drivers/cdx/cdx.c
> +++ b/drivers/cdx/cdx.c
> @@ -72,6 +72,8 @@
>
> /* CDX controllers registered with the CDX bus */
> static DEFINE_XARRAY_ALLOC(cdx_controllers);
> +/* Lock to protect controller ops and controller list */
> +static DEFINE_MUTEX(cdx_controller_lock);
Wait, why do you have a local list and not just rely on the list the
driver core has for you already? Isn't this a duplicate list where you
have objects on two different lists with a lifespan controlled only by
one of them?
thanks,
greg k-h
next prev parent reply other threads:[~2023-07-31 12:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 12:08 [PATCH v2 0/4] cdx: provide sysfs interface for cdx device resources Abhijit Gangurde
2023-07-31 12:08 ` [PATCH v2 1/4] cdx: Introduce lock to protect controller ops and controller list Abhijit Gangurde
2023-07-31 12:24 ` Greg KH [this message]
2023-08-01 8:34 ` Gangurde, Abhijit
2023-08-01 8:40 ` Greg KH
2023-08-02 11:20 ` Gangurde, Abhijit
2023-08-02 11:49 ` Greg KH
2023-08-04 11:11 ` Gangurde, Abhijit
2023-07-31 12:08 ` [PATCH v2 2/4] cdx: add support for bus enable and disable Abhijit Gangurde
2023-07-31 12:08 ` [PATCH v2 3/4] cdx: add sysfs for bus reset Abhijit Gangurde
2023-07-31 12:08 ` [PATCH v2 4/4] cdx: add sysfs for subsystem, class and revision Abhijit Gangurde
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=2023073148-carried-unshaved-77e4@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Nipun.Gupta@amd.com \
--cc=abhijit.gangurde@amd.com \
--cc=git@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.simek@amd.com \
--cc=nikhil.agarwal@amd.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