Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Bjorn Andersson <andersson@kernel.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, Daniel Lee <chullee@google.com>,
	Peter Wang <peter.wang@mediatek.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Huan Tang <tanghuan@vivo.com>, Avri Altman <avri.altman@wdc.com>,
	"Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
	Gwendal Grignou <gwendal@chromium.org>,
	Liu Song <liu.song13@zte.com.cn>, Bean Huo <huobean@gmail.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Can Guo <quic_cang@quicinc.com>,
	Eric Biggers <ebiggers@kernel.org>,
	Nitin Rawat <quic_nitirawa@quicinc.com>,
	Neil Armstrong <neil.armstrong@linaro.org>
Subject: Re: [PATCH 2/2] ufs: core: Really fix the code for updating the "hid" attribute group
Date: Tue, 28 Oct 2025 06:57:07 -0700	[thread overview]
Message-ID: <6acc1879-ebb9-4e51-bbe9-3824f8f1711f@acm.org> (raw)
In-Reply-To: <fysnm3cpnz6ipqw4tbw2jh3rvxqjzgabmz2oppccjus3gv2sab@oi6dz4o4zkw2>


On 10/27/25 8:03 PM, Bjorn Andersson wrote:
> So, unless I'm missing something with regards to the error handler that
> you refer to, I think you should solve this problem in ufshcd_init(), by
> making sure that syfs attributes are created before the
> ufshcd_device_params_init() call.

Something like this? (needs more work to make sure all state information 
that can be modified through sysfs has been initialized before the sysfs 
attributes are added)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 5d6297aa5c28..3ad258922036 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10800,6 +10800,8 @@ int ufshcd_init(struct ufs_hba *hba, void 
__iomem *mmio_base, unsigned int irq)
          */
         ufshcd_readl(hba, REG_INTERRUPT_ENABLE);

+       ufs_sysfs_add_nodes(hba->dev);
+
         /* IRQ registration */
         err = devm_request_threaded_irq(dev, irq, ufshcd_intr, 
ufshcd_threaded_intr,
                                         IRQF_ONESHOT | IRQF_SHARED, 
UFSHCD, hba);
@@ -10887,7 +10889,6 @@ int ufshcd_init(struct ufs_hba *hba, void 
__iomem *mmio_base, unsigned int irq)
         if (err)
                 goto out_disable;

-       ufs_sysfs_add_nodes(hba->dev);
         async_schedule(ufshcd_async_scan, hba);

         device_enable_async_suspend(dev);

> PS. How come these are attributes on the host device and not on the SCSI
> host device (i.e. ufshcd_driver_template::shost_groups)? It seems like
> more structured place to have such properties, and would avoid having to
> dynamically create/destroy them from the ufshcd driver itself.

This choice was made before I started contributing to the UFSHCI driver.
I'm not sure why this choice has been made. If we would start over from
scratch, I think the UFSHCI attributes should be added to the UFSHCI
device instance and the UFS attributes should be added to the SCSI host.
Today the sysfs attributes created by the UFSHCI driver are a mix of
UFSHCI and UFS attributes.

This is a change we can't make today because it would break user space.

Thanks,

Bart.

  parent reply	other threads:[~2025-10-28 13:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 17:09 [PATCH 0/2] Two additional UFS fixes for this rc cycle Bart Van Assche
2025-10-27 17:09 ` [PATCH 1/2] ufs: core: Change the ufs_sysfs_{add,remove}_nodes() argument type Bart Van Assche
2025-10-27 17:09 ` [PATCH 2/2] ufs: core: Really fix the code for updating the "hid" attribute group Bart Van Assche
2025-10-28  3:03   ` Bjorn Andersson
2025-10-28 12:47     ` Peter Wang (王信友)
2025-10-28 13:33       ` Bart Van Assche
2025-10-28 13:57     ` Bart Van Assche [this message]
2025-10-28 14:50       ` Bjorn Andersson
2025-10-28 20:21         ` Bart Van Assche
2025-10-28  9:51   ` Neil Armstrong

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=6acc1879-ebb9-4e51-bbe9-3824f8f1711f@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=avri.altman@wdc.com \
    --cc=chullee@google.com \
    --cc=ebiggers@kernel.org \
    --cc=gwendal@chromium.org \
    --cc=huobean@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liu.song13@zte.com.cn \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=tanghuan@vivo.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