All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Vitor Soares <Vitor.Soares@synopsys.com>
Cc: linux-kernel@vger.kernel.org, pgaj@cadence.com,
	linux-i3c@lists.infradead.org, bbrezillon@kernel.org
Subject: Re: [PATCH v2 2/4] i3c: Add modalias sysfs attribute
Date: Thu, 27 Feb 2020 15:41:15 +0100	[thread overview]
Message-ID: <20200227154115.77c42274@collabora.com> (raw)
In-Reply-To: <a90f64f830128cd12762153de7828b775574c156.1582796652.git.vitor.soares@synopsys.com>

On Thu, 27 Feb 2020 12:31:07 +0100
Vitor Soares <Vitor.Soares@synopsys.com> wrote:

> Create modalias sysfs attribute for modalias devices.

					^i3c

No need to send a new version, I'll fix it when applying.

> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
> ---
>  drivers/i3c/master.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index b6db828..925e1ed 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -241,12 +241,34 @@ static ssize_t hdrcap_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(hdrcap);
>  
> +static ssize_t modalias_show(struct device *dev,
> +			     struct device_attribute *da, char *buf)
> +{
> +	struct i3c_device *i3c = dev_to_i3cdev(dev);
> +	struct i3c_device_info devinfo;
> +	u16 manuf, part, ext;
> +
> +	i3c_device_get_info(i3c, &devinfo);
> +	manuf = I3C_PID_MANUF_ID(devinfo.pid);
> +	part = I3C_PID_PART_ID(devinfo.pid);
> +	ext = I3C_PID_EXTRA_INFO(devinfo.pid);
> +
> +	if (I3C_PID_RND_LOWER_32BITS(devinfo.pid))
> +		return sprintf(buf, "i3c:dcr%02Xmanuf%04X", devinfo.dcr,
> +			       manuf);
> +
> +	return sprintf(buf, "i3c:dcr%02Xmanuf%04Xpart%04Xext%04X",
> +		       devinfo.dcr, manuf, part, ext);
> +}
> +static DEVICE_ATTR_RO(modalias);
> +
>  static struct attribute *i3c_device_attrs[] = {
>  	&dev_attr_bcr.attr,
>  	&dev_attr_dcr.attr,
>  	&dev_attr_pid.attr,
>  	&dev_attr_dynamic_address.attr,
>  	&dev_attr_hdrcap.attr,
> +	&dev_attr_modalias.attr,
>  	NULL,
>  };
>  ATTRIBUTE_GROUPS(i3c_device);


_______________________________________________
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Vitor Soares <Vitor.Soares@synopsys.com>
Cc: pgaj@cadence.com, bbrezillon@kernel.org,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] i3c: Add modalias sysfs attribute
Date: Thu, 27 Feb 2020 15:41:15 +0100	[thread overview]
Message-ID: <20200227154115.77c42274@collabora.com> (raw)
In-Reply-To: <a90f64f830128cd12762153de7828b775574c156.1582796652.git.vitor.soares@synopsys.com>

On Thu, 27 Feb 2020 12:31:07 +0100
Vitor Soares <Vitor.Soares@synopsys.com> wrote:

> Create modalias sysfs attribute for modalias devices.

					^i3c

No need to send a new version, I'll fix it when applying.

> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
> ---
>  drivers/i3c/master.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index b6db828..925e1ed 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -241,12 +241,34 @@ static ssize_t hdrcap_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(hdrcap);
>  
> +static ssize_t modalias_show(struct device *dev,
> +			     struct device_attribute *da, char *buf)
> +{
> +	struct i3c_device *i3c = dev_to_i3cdev(dev);
> +	struct i3c_device_info devinfo;
> +	u16 manuf, part, ext;
> +
> +	i3c_device_get_info(i3c, &devinfo);
> +	manuf = I3C_PID_MANUF_ID(devinfo.pid);
> +	part = I3C_PID_PART_ID(devinfo.pid);
> +	ext = I3C_PID_EXTRA_INFO(devinfo.pid);
> +
> +	if (I3C_PID_RND_LOWER_32BITS(devinfo.pid))
> +		return sprintf(buf, "i3c:dcr%02Xmanuf%04X", devinfo.dcr,
> +			       manuf);
> +
> +	return sprintf(buf, "i3c:dcr%02Xmanuf%04Xpart%04Xext%04X",
> +		       devinfo.dcr, manuf, part, ext);
> +}
> +static DEVICE_ATTR_RO(modalias);
> +
>  static struct attribute *i3c_device_attrs[] = {
>  	&dev_attr_bcr.attr,
>  	&dev_attr_dcr.attr,
>  	&dev_attr_pid.attr,
>  	&dev_attr_dynamic_address.attr,
>  	&dev_attr_hdrcap.attr,
> +	&dev_attr_modalias.attr,
>  	NULL,
>  };
>  ATTRIBUTE_GROUPS(i3c_device);


  reply	other threads:[~2020-02-27 14:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 11:31 [PATCH v2 0/4] i3c: Address i3c_device_id related issues Vitor Soares
2020-02-27 11:31 ` Vitor Soares
2020-02-27 11:31 ` [PATCH v2 1/4] i3c: Fix MODALIAS uevents Vitor Soares
2020-02-27 11:31   ` Vitor Soares
2020-02-27 11:31 ` [PATCH v2 2/4] i3c: Add modalias sysfs attribute Vitor Soares
2020-02-27 11:31   ` Vitor Soares
2020-02-27 14:41   ` Boris Brezillon [this message]
2020-02-27 14:41     ` Boris Brezillon
2020-02-27 11:31 ` [PATCH v2 3/4] i3c: Generate aliases for i3c modules Vitor Soares
2020-02-27 11:31   ` Vitor Soares
2020-02-27 11:31 ` [PATCH v2 4/4] i3c: Simplify i3c_device_match_id() Vitor Soares
2020-02-27 11:31   ` Vitor Soares

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=20200227154115.77c42274@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=Vitor.Soares@synopsys.com \
    --cc=bbrezillon@kernel.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pgaj@cadence.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.