From: Jason Yan <yanaijie@huawei.com>
To: Xingui Yang <yangxingui@huawei.com>, <john.garry@huawei.com>,
<liyihang9@huawei.com>
Cc: <jejb@linux.ibm.com>, <martin.petersen@oracle.com>,
<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, <prime.zeng@huawei.com>,
<liuyonglong@huawei.com>, <kangfenglong@huawei.com>,
<liyangyang20@huawei.com>, <f.fangjian@huawei.com>,
<xiabing14@h-partners.com>
Subject: Re: [PATCH v3 2/3] scsi: libsas: Move sas_put_device() to libsas.h
Date: Fri, 21 Feb 2025 10:36:53 +0800 [thread overview]
Message-ID: <f8811c44-0441-434e-8f3a-e8aec3032013@huawei.com> (raw)
In-Reply-To: <20250220130546.2289555-3-yangxingui@huawei.com>
在 2025/2/20 21:05, Xingui Yang 写道:
> As sas_put_device() needs to be called in lldd, it is now moved to libsas.h
>
> Signed-off-by: Xingui Yang <yangxingui@huawei.com>
> ---
> drivers/scsi/libsas/sas_discover.c | 1 +
> drivers/scsi/libsas/sas_internal.h | 6 ------
> include/scsi/libsas.h | 6 ++++++
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
> index 951bdc554a10..43a65d0542ab 100644
> --- a/drivers/scsi/libsas/sas_discover.c
> +++ b/drivers/scsi/libsas/sas_discover.c
> @@ -309,6 +309,7 @@ void sas_free_device(struct kref *kref)
>
> kfree(dev);
> }
> +EXPORT_SYMBOL_GPL(sas_free_device);
>
> static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_device *dev)
> {
> diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
> index 03d6ec1eb970..a1e364deb3ee 100644
> --- a/drivers/scsi/libsas/sas_internal.h
> +++ b/drivers/scsi/libsas/sas_internal.h
> @@ -98,7 +98,6 @@ int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
> u8 *sas_addr, enum sas_device_type *type);
> int sas_try_ata_reset(struct asd_sas_phy *phy);
>
> -void sas_free_device(struct kref *kref);
> void sas_destruct_devices(struct asd_sas_port *port);
>
> extern const work_func_t sas_phy_event_fns[PHY_NUM_EVENTS];
> @@ -217,9 +216,4 @@ static inline struct domain_device *sas_alloc_device(void)
> return dev;
> }
>
> -static inline void sas_put_device(struct domain_device *dev)
> -{
> - kref_put(&dev->kref, sas_free_device);
> -}
> -
> #endif /* _SAS_INTERNAL_H_ */
> diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
> index ba460b6c0374..f67137f50980 100644
> --- a/include/scsi/libsas.h
> +++ b/include/scsi/libsas.h
> @@ -425,6 +425,12 @@ static inline void sas_put_local_phy(struct sas_phy *phy)
> put_device(&phy->dev);
> }
>
> +void sas_free_device(struct kref *kref);
> +static inline void sas_put_device(struct domain_device *dev)
> +{
> + kref_put(&dev->kref, sas_free_device);
> +}
As we have discussed internally, I still think exporting
sas_put_device() is not a good idea. I prefer exporting an interface to
iterate sas_port->dev_list and let the caller operate the domain device.
Thanks,
Jason
> +
> #ifdef CONFIG_SCSI_SAS_HOST_SMP
> int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
> #else
next prev parent reply other threads:[~2025-02-21 2:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 13:05 [PATCH v3 0/3] scsi: hisi_sas: Fixed IO error caused by port id not updated Xingui Yang
2025-02-20 13:05 ` [PATCH v3 1/3] scsi: hisi_sas: Enable force phy when SATA disk directly connected Xingui Yang
2025-02-20 17:35 ` John Garry
2025-02-21 1:59 ` yangxingui
2025-02-24 8:29 ` John Garry
2025-02-24 9:36 ` yangxingui
2025-02-24 12:21 ` John Garry
2025-02-24 13:12 ` yangxingui
2025-02-24 17:34 ` John Garry
2025-02-25 1:48 ` yangxingui
2025-02-25 8:19 ` John Garry
2025-02-25 9:35 ` yangxingui
2025-02-26 8:57 ` John Garry
2025-02-27 8:33 ` yangxingui
2025-03-04 9:48 ` John Garry
2025-03-05 8:16 ` yangxingui
2025-03-05 16:15 ` John Garry
2025-03-06 1:44 ` yangxingui
2025-03-10 13:09 ` yangxingui
2025-03-10 17:45 ` John Garry
2025-03-11 1:53 ` yangxingui
2025-03-12 9:44 ` yangxingui
2025-03-12 11:19 ` John Garry
2025-02-20 13:05 ` [PATCH v3 2/3] scsi: libsas: Move sas_put_device() to libsas.h Xingui Yang
2025-02-21 2:36 ` Jason Yan [this message]
2025-02-20 13:05 ` [PATCH v3 3/3] scsi: hisi_sas: Fixed IO error caused by port id not updated Xingui Yang
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=f8811c44-0441-434e-8f3a-e8aec3032013@huawei.com \
--to=yanaijie@huawei.com \
--cc=f.fangjian@huawei.com \
--cc=jejb@linux.ibm.com \
--cc=john.garry@huawei.com \
--cc=kangfenglong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=liyangyang20@huawei.com \
--cc=liyihang9@huawei.com \
--cc=martin.petersen@oracle.com \
--cc=prime.zeng@huawei.com \
--cc=xiabing14@h-partners.com \
--cc=yangxingui@huawei.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