mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <avri.altman@wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] scsi: ufs: Add HCI capabilities sysfs group
Date: Wed, 31 Jul 2024 14:13:08 -0700	[thread overview]
Message-ID: <0b3c0120-a680-455a-abfd-b3b6b0ddbed4@acm.org> (raw)
In-Reply-To: <20240731122051.2058406-3-avri.altman@wdc.com>

On 7/31/24 5:20 AM, Avri Altman wrote:
> +static ssize_t capabilities_show(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> +	return sysfs_emit(buf, "0x%x\n", hba->capabilities);
> +}

For every new sysfs entry that is added, documentation must be added
in Documentation/ABI/testing/sysfs-driver-ufs.

> +static ssize_t ext_capabilities_show(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	int ret;
> +	u32 val;
> +	struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> +	if (hba->ufs_version < ufshci_version(4, 0))
> +		return -EOPNOTSUPP;
> +
> +	ret = ufshcd_read_hci_reg(hba, &val, REG_EXT_CONTROLLER_CAPABILITIES);
> +	if (ret)
> +		return ret;
> +
> +	return sysfs_emit(buf, "0x%x\n", val);
> +}

Host controller register reads must be protected by ufshcd_rpm_get_sync(hba) /
ufshcd_rpm_put_sync(hba).

Thanks,

Bart.

  reply	other threads:[~2024-07-31 21:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 12:20 [PATCH 0/2] scsi: ufs: Add host " Avri Altman
2024-07-31 12:20 ` [PATCH 1/2] scsi: ufs: Prepare to add HCI capabilities sysfs Avri Altman
2024-07-31 12:20 ` [PATCH 2/2] scsi: ufs: Add HCI capabilities sysfs group Avri Altman
2024-07-31 21:13   ` Bart Van Assche [this message]
2024-08-01  7:01     ` Avri Altman

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=0b3c0120-a680-455a-abfd-b3b6b0ddbed4@acm.org \
    --to=bvanassche@acm.org \
    --cc=avri.altman@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®