All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs
@ 2019-12-09 19:23 Liming Sun
  2019-12-13 10:21 ` Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Liming Sun @ 2019-12-09 19:23 UTC (permalink / raw)
  To: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods
  Cc: Liming Sun, platform-driver-x86, linux-kernel

This is a follow-up commit for the sysfs attributes to change
from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
In such case, it's better to point the sysfs path to the device
itself instead of the driver. This commit adds the missing
sysfs_create_group() so the attributes can be created under the
device. The ABI document is also updated.

Signed-off-by: Liming Sun <lsun@mellanox.com>
---
 Documentation/ABI/testing/sysfs-platform-mellanox-bootctl | 10 +++++-----
 drivers/platform/mellanox/mlxbf-bootctl.c                 | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
index c65a805..401d202 100644
--- a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
+++ b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
@@ -1,4 +1,4 @@
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/lifecycle_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/lifecycle_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -10,7 +10,7 @@ Description:
 		  GA Non-Secured - Non-Secure chip and not able to change state
 		  RMA - Return Merchandise Authorization
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/post_reset_wdog
+What:		/sys/bus/platform/devices/MLNXBF04:00/post_reset_wdog
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -19,7 +19,7 @@ Description:
 		to reboot the chip and recover it to the old state if the new
 		boot partition fails.
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -30,7 +30,7 @@ Description:
 		  emmc - boot from the onchip eMMC
 		  emmc_legacy - boot from the onchip eMMC in legacy (slow) mode
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/second_reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/second_reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -44,7 +44,7 @@ Description:
 		  swap_emmc - swap the primary / secondary boot partition
 		  none - cancel the action
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/secure_boot_fuse_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/secure_boot_fuse_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c
index 61753b6..9482eab 100644
--- a/drivers/platform/mellanox/mlxbf-bootctl.c
+++ b/drivers/platform/mellanox/mlxbf-bootctl.c
@@ -282,9 +282,16 @@ static bool mlxbf_bootctl_guid_match(const guid_t *guid,
 static int mlxbf_bootctl_probe(struct platform_device *pdev)
 {
 	struct arm_smccc_res res = { 0 };
+	struct device *dev = &pdev->dev;
 	guid_t guid;
 	int ret;
 
+	ret = sysfs_create_group(&dev->kobj, &mlxbf_bootctl_group);
+	if (ret) {
+		dev_err(dev, "failed to create attributes, err=%d\n", ret);
+		return ret;
+	}
+
 	/* Ensure we have the UUID we expect for this service. */
 	arm_smccc_smc(MLXBF_BOOTCTL_SIP_SVC_UID, 0, 0, 0, 0, 0, 0, 0, &res);
 	guid_parse(mlxbf_bootctl_svc_uuid_str, &guid);
@@ -305,8 +312,16 @@ static int mlxbf_bootctl_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int mlxbf_bootctl_remove(struct platform_device *pdev)
+{
+	sysfs_remove_group(&pdev->dev.kobj, &mlxbf_bootctl_group);
+
+	return 0;
+}
+
 static struct platform_driver mlxbf_bootctl_driver = {
 	.probe = mlxbf_bootctl_probe,
+	.remove = mlxbf_bootctl_remove,
 	.driver = {
 		.name = "mlxbf-bootctl",
 		.groups = mlxbf_bootctl_groups,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-09 19:23 [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs Liming Sun
@ 2019-12-13 10:21 ` Andy Shevchenko
  2019-12-13 15:22   ` Liming Sun
  2019-12-13 15:21 ` [PATCH v2] " Liming Sun
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2019-12-13 10:21 UTC (permalink / raw)
  To: Liming Sun
  Cc: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods,
	Platform Driver, Linux Kernel Mailing List

On Mon, Dec 9, 2019 at 9:24 PM Liming Sun <lsun@mellanox.com> wrote:
>
> This is a follow-up commit for the sysfs attributes to change
> from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
> In such case, it's better to point the sysfs path to the device
> itself instead of the driver. This commit adds the missing
> sysfs_create_group() so the attributes can be created under the
> device. The ABI document is also updated.
>

Fixes tag, please.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-09 19:23 [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs Liming Sun
  2019-12-13 10:21 ` Andy Shevchenko
@ 2019-12-13 15:21 ` Liming Sun
  2019-12-18 13:00   ` Andy Shevchenko
  2019-12-18 15:24 ` [PATCH v3] " Liming Sun
  2019-12-18 18:35 ` [PATCH v4] " Liming Sun
  3 siblings, 1 reply; 10+ messages in thread
From: Liming Sun @ 2019-12-13 15:21 UTC (permalink / raw)
  To: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods
  Cc: Liming Sun, platform-driver-x86, linux-kernel

This is a follow-up commit for the sysfs attributes to change
from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
In such case, it's better to point the sysfs path to the device
itself instead of the driver. This commit adds the missing
sysfs_create_group() so the attributes can be created under the
device. The ABI document is also updated.

Fixes: 79e29cb8fbc5 ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
Signed-off-by: Liming Sun <lsun@mellanox.com>
---
v1->v2: Added the Fixes tag according to Andy's comment.
v1: Initial version.
---
 Documentation/ABI/testing/sysfs-platform-mellanox-bootctl | 10 +++++-----
 drivers/platform/mellanox/mlxbf-bootctl.c                 | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
index c65a805..401d202 100644
--- a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
+++ b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
@@ -1,4 +1,4 @@
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/lifecycle_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/lifecycle_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -10,7 +10,7 @@ Description:
 		  GA Non-Secured - Non-Secure chip and not able to change state
 		  RMA - Return Merchandise Authorization
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/post_reset_wdog
+What:		/sys/bus/platform/devices/MLNXBF04:00/post_reset_wdog
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -19,7 +19,7 @@ Description:
 		to reboot the chip and recover it to the old state if the new
 		boot partition fails.
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -30,7 +30,7 @@ Description:
 		  emmc - boot from the onchip eMMC
 		  emmc_legacy - boot from the onchip eMMC in legacy (slow) mode
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/second_reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/second_reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -44,7 +44,7 @@ Description:
 		  swap_emmc - swap the primary / secondary boot partition
 		  none - cancel the action
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/secure_boot_fuse_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/secure_boot_fuse_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c
index 61753b6..9482eab 100644
--- a/drivers/platform/mellanox/mlxbf-bootctl.c
+++ b/drivers/platform/mellanox/mlxbf-bootctl.c
@@ -282,9 +282,16 @@ static bool mlxbf_bootctl_guid_match(const guid_t *guid,
 static int mlxbf_bootctl_probe(struct platform_device *pdev)
 {
 	struct arm_smccc_res res = { 0 };
+	struct device *dev = &pdev->dev;
 	guid_t guid;
 	int ret;
 
+	ret = sysfs_create_group(&dev->kobj, &mlxbf_bootctl_group);
+	if (ret) {
+		dev_err(dev, "failed to create attributes, err=%d\n", ret);
+		return ret;
+	}
+
 	/* Ensure we have the UUID we expect for this service. */
 	arm_smccc_smc(MLXBF_BOOTCTL_SIP_SVC_UID, 0, 0, 0, 0, 0, 0, 0, &res);
 	guid_parse(mlxbf_bootctl_svc_uuid_str, &guid);
@@ -305,8 +312,16 @@ static int mlxbf_bootctl_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int mlxbf_bootctl_remove(struct platform_device *pdev)
+{
+	sysfs_remove_group(&pdev->dev.kobj, &mlxbf_bootctl_group);
+
+	return 0;
+}
+
 static struct platform_driver mlxbf_bootctl_driver = {
 	.probe = mlxbf_bootctl_probe,
+	.remove = mlxbf_bootctl_remove,
 	.driver = {
 		.name = "mlxbf-bootctl",
 		.groups = mlxbf_bootctl_groups,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-13 10:21 ` Andy Shevchenko
@ 2019-12-13 15:22   ` Liming Sun
  0 siblings, 0 replies; 10+ messages in thread
From: Liming Sun @ 2019-12-13 15:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods,
	Platform Driver, Linux Kernel Mailing List

Thanks! Updated in v2.

- Liming

> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Friday, December 13, 2019 5:21 AM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Andy Shevchenko <andy@infradead.org>; Darren Hart <dvhart@infradead.org>; Vadim Pasternak <vadimp@mellanox.com>; David
> Woods <dwoods@mellanox.com>; Platform Driver <platform-driver-x86@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs
> 
> On Mon, Dec 9, 2019 at 9:24 PM Liming Sun <lsun@mellanox.com> wrote:
> >
> > This is a follow-up commit for the sysfs attributes to change
> > from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
> > In such case, it's better to point the sysfs path to the device
> > itself instead of the driver. This commit adds the missing
> > sysfs_create_group() so the attributes can be created under the
> > device. The ABI document is also updated.
> >
> 
> Fixes tag, please.
> 
> --
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-13 15:21 ` [PATCH v2] " Liming Sun
@ 2019-12-18 13:00   ` Andy Shevchenko
  2019-12-18 15:26     ` Liming Sun
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2019-12-18 13:00 UTC (permalink / raw)
  To: Liming Sun
  Cc: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods,
	Platform Driver, Linux Kernel Mailing List

On Fri, Dec 13, 2019 at 5:21 PM Liming Sun <lsun@mellanox.com> wrote:

> +       ret = sysfs_create_group(&dev->kobj, &mlxbf_bootctl_group);
> +       if (ret) {
> +               dev_err(dev, "failed to create attributes, err=%d\n", ret);
> +               return ret;
> +       }
> +
>         /* Ensure we have the UUID we expect for this service. */
>         arm_smccc_smc(MLXBF_BOOTCTL_SIP_SVC_UID, 0, 0, 0, 0, 0, 0, 0, &res);
>         guid_parse(mlxbf_bootctl_svc_uuid_str, &guid);
> @@ -305,8 +312,16 @@ static int mlxbf_bootctl_probe(struct platform_device *pdev)
>         return 0;
>  }
>
> +static int mlxbf_bootctl_remove(struct platform_device *pdev)
> +{
> +       sysfs_remove_group(&pdev->dev.kobj, &mlxbf_bootctl_group);
> +
> +       return 0;
> +}
> +
>  static struct platform_driver mlxbf_bootctl_driver = {
>         .probe = mlxbf_bootctl_probe,
> +       .remove = mlxbf_bootctl_remove,
>         .driver = {
>                 .name = "mlxbf-bootctl",
>                 .groups = mlxbf_bootctl_groups,

Please, use dev_groups member of the struct driver instead of above approach.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-09 19:23 [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs Liming Sun
  2019-12-13 10:21 ` Andy Shevchenko
  2019-12-13 15:21 ` [PATCH v2] " Liming Sun
@ 2019-12-18 15:24 ` Liming Sun
  2019-12-18 17:59   ` Andy Shevchenko
  2019-12-18 18:35 ` [PATCH v4] " Liming Sun
  3 siblings, 1 reply; 10+ messages in thread
From: Liming Sun @ 2019-12-18 15:24 UTC (permalink / raw)
  To: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods
  Cc: Liming Sun, platform-driver-x86, linux-kernel

This is a follow-up commit for the sysfs attributes to change
from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
In such case, it's better to point the sysfs path to the device
itself instead of the driver. The ABI document is also updated.

Fixes: 79e29cb8fbc5 ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
Signed-off-by: Liming Sun <lsun@mellanox.com>
---
v2->v3:
    Fixes for comments from Andy
    - Convert to use dev_groups;
v1->v2:
    Fixes for comments from Andy
    - Added the Fixes tag;
v1: Initial version.
---
 Documentation/ABI/testing/sysfs-platform-mellanox-bootctl | 10 +++++-----
 drivers/platform/mellanox/mlxbf-bootctl.c                 | 11 +++++++++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
index c65a805..401d202 100644
--- a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
+++ b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
@@ -1,4 +1,4 @@
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/lifecycle_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/lifecycle_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -10,7 +10,7 @@ Description:
 		  GA Non-Secured - Non-Secure chip and not able to change state
 		  RMA - Return Merchandise Authorization
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/post_reset_wdog
+What:		/sys/bus/platform/devices/MLNXBF04:00/post_reset_wdog
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -19,7 +19,7 @@ Description:
 		to reboot the chip and recover it to the old state if the new
 		boot partition fails.
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -30,7 +30,7 @@ Description:
 		  emmc - boot from the onchip eMMC
 		  emmc_legacy - boot from the onchip eMMC in legacy (slow) mode
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/second_reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/second_reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -44,7 +44,7 @@ Description:
 		  swap_emmc - swap the primary / secondary boot partition
 		  none - cancel the action
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/secure_boot_fuse_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/secure_boot_fuse_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c
index 61753b6..472dc74 100644
--- a/drivers/platform/mellanox/mlxbf-bootctl.c
+++ b/drivers/platform/mellanox/mlxbf-bootctl.c
@@ -259,7 +259,9 @@ static ssize_t secure_boot_fuse_state_show(struct device *dev,
 	NULL
 };
 
-ATTRIBUTE_GROUPS(mlxbf_bootctl);
+static const struct attribute_group mlxbf_bootctl_group = {
+	.attrs	= mlxbf_bootctl_attrs,
+};
 
 static const struct acpi_device_id mlxbf_bootctl_acpi_ids[] = {
 	{"MLNXBF04", 0},
@@ -305,11 +307,16 @@ static int mlxbf_bootctl_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct attribute_group *mlxbf_bootctl_dev_groups[] = {
+	&mlxbf_bootctl_group,
+	NULL
+};
+
 static struct platform_driver mlxbf_bootctl_driver = {
 	.probe = mlxbf_bootctl_probe,
 	.driver = {
 		.name = "mlxbf-bootctl",
-		.groups = mlxbf_bootctl_groups,
+		.dev_groups = mlxbf_bootctl_dev_groups,
 		.acpi_match_table = mlxbf_bootctl_acpi_ids,
 	}
 };
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH v2] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-18 13:00   ` Andy Shevchenko
@ 2019-12-18 15:26     ` Liming Sun
  0 siblings, 0 replies; 10+ messages in thread
From: Liming Sun @ 2019-12-18 15:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods,
	Platform Driver, Linux Kernel Mailing List

Thanks Andy for the comments. v3 has been posted with the updates.

- Liming

> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Wednesday, December 18, 2019 8:01 AM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Andy Shevchenko <andy@infradead.org>; Darren Hart <dvhart@infradead.org>; Vadim Pasternak <vadimp@mellanox.com>; David
> Woods <dwoods@mellanox.com>; Platform Driver <platform-driver-x86@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH v2] platform/mellanox: fix the mlx-bootctl sysfs
> 
> On Fri, Dec 13, 2019 at 5:21 PM Liming Sun <lsun@mellanox.com> wrote:
> 
> > +       ret = sysfs_create_group(&dev->kobj, &mlxbf_bootctl_group);
> > +       if (ret) {
> > +               dev_err(dev, "failed to create attributes, err=%d\n", ret);
> > +               return ret;
> > +       }
> > +
> >         /* Ensure we have the UUID we expect for this service. */
> >         arm_smccc_smc(MLXBF_BOOTCTL_SIP_SVC_UID, 0, 0, 0, 0, 0, 0, 0, &res);
> >         guid_parse(mlxbf_bootctl_svc_uuid_str, &guid);
> > @@ -305,8 +312,16 @@ static int mlxbf_bootctl_probe(struct platform_device *pdev)
> >         return 0;
> >  }
> >
> > +static int mlxbf_bootctl_remove(struct platform_device *pdev)
> > +{
> > +       sysfs_remove_group(&pdev->dev.kobj, &mlxbf_bootctl_group);
> > +
> > +       return 0;
> > +}
> > +
> >  static struct platform_driver mlxbf_bootctl_driver = {
> >         .probe = mlxbf_bootctl_probe,
> > +       .remove = mlxbf_bootctl_remove,
> >         .driver = {
> >                 .name = "mlxbf-bootctl",
> >                 .groups = mlxbf_bootctl_groups,
> 
> Please, use dev_groups member of the struct driver instead of above approach.
> 
> --
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-18 15:24 ` [PATCH v3] " Liming Sun
@ 2019-12-18 17:59   ` Andy Shevchenko
  2019-12-18 18:36     ` Liming Sun
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2019-12-18 17:59 UTC (permalink / raw)
  To: Liming Sun
  Cc: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods,
	Platform Driver, Linux Kernel Mailing List

On Wed, Dec 18, 2019 at 5:25 PM Liming Sun <lsun@mellanox.com> wrote:
>
> This is a follow-up commit for the sysfs attributes to change
> from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
> In such case, it's better to point the sysfs path to the device
> itself instead of the driver. The ABI document is also updated.
>
> Fixes: 79e29cb8fbc5 ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
> Signed-off-by: Liming Sun <lsun@mellanox.com>

...

> -ATTRIBUTE_GROUPS(mlxbf_bootctl);

What's wrong with above macro?

> +static const struct attribute_group mlxbf_bootctl_group = {
> +       .attrs  = mlxbf_bootctl_attrs,
> +};

...

> +static const struct attribute_group *mlxbf_bootctl_dev_groups[] = {
> +       &mlxbf_bootctl_group,
> +       NULL
> +};

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-09 19:23 [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs Liming Sun
                   ` (2 preceding siblings ...)
  2019-12-18 15:24 ` [PATCH v3] " Liming Sun
@ 2019-12-18 18:35 ` Liming Sun
  3 siblings, 0 replies; 10+ messages in thread
From: Liming Sun @ 2019-12-18 18:35 UTC (permalink / raw)
  To: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods
  Cc: Liming Sun, platform-driver-x86, linux-kernel

This is a follow-up commit for the sysfs attributes to change
from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
In such case, it's better to point the sysfs path to the device
itself instead of the driver. The ABI document is also updated.

Fixes: 79e29cb8fbc5 ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
Signed-off-by: Liming Sun <lsun@mellanox.com>
---
v3->v4:
    Fixes for comments from Andy
    - Simplify the change with ATTRIBUTE_GROUPS();
v2->v3:
    Fixes for comments from Andy
    - Convert to use dev_groups;
v1->v2:
    Fixes for comments from Andy
    - Added the Fixes tag;
v1: Initial version.
---
 Documentation/ABI/testing/sysfs-platform-mellanox-bootctl | 10 +++++-----
 drivers/platform/mellanox/mlxbf-bootctl.c                 |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
index c65a805..401d202 100644
--- a/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
+++ b/Documentation/ABI/testing/sysfs-platform-mellanox-bootctl
@@ -1,4 +1,4 @@
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/lifecycle_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/lifecycle_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -10,7 +10,7 @@ Description:
 		  GA Non-Secured - Non-Secure chip and not able to change state
 		  RMA - Return Merchandise Authorization
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/post_reset_wdog
+What:		/sys/bus/platform/devices/MLNXBF04:00/post_reset_wdog
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -19,7 +19,7 @@ Description:
 		to reboot the chip and recover it to the old state if the new
 		boot partition fails.
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -30,7 +30,7 @@ Description:
 		  emmc - boot from the onchip eMMC
 		  emmc_legacy - boot from the onchip eMMC in legacy (slow) mode
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/second_reset_action
+What:		/sys/bus/platform/devices/MLNXBF04:00/second_reset_action
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
@@ -44,7 +44,7 @@ Description:
 		  swap_emmc - swap the primary / secondary boot partition
 		  none - cancel the action
 
-What:		/sys/bus/platform/devices/MLNXBF04:00/driver/secure_boot_fuse_state
+What:		/sys/bus/platform/devices/MLNXBF04:00/secure_boot_fuse_state
 Date:		Oct 2019
 KernelVersion:	5.5
 Contact:	"Liming Sun <lsun@mellanox.com>"
diff --git a/drivers/platform/mellanox/mlxbf-bootctl.c b/drivers/platform/mellanox/mlxbf-bootctl.c
index 61753b6..5d21c6a 100644
--- a/drivers/platform/mellanox/mlxbf-bootctl.c
+++ b/drivers/platform/mellanox/mlxbf-bootctl.c
@@ -309,7 +309,7 @@ static int mlxbf_bootctl_probe(struct platform_device *pdev)
 	.probe = mlxbf_bootctl_probe,
 	.driver = {
 		.name = "mlxbf-bootctl",
-		.groups = mlxbf_bootctl_groups,
+		.dev_groups = mlxbf_bootctl_groups,
 		.acpi_match_table = mlxbf_bootctl_acpi_ids,
 	}
 };
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH v3] platform/mellanox: fix the mlx-bootctl sysfs
  2019-12-18 17:59   ` Andy Shevchenko
@ 2019-12-18 18:36     ` Liming Sun
  0 siblings, 0 replies; 10+ messages in thread
From: Liming Sun @ 2019-12-18 18:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Darren Hart, Vadim Pasternak, David Woods,
	Platform Driver, Linux Kernel Mailing List

Sorry I misunderstood the last comment. Verified and posted v4.

- Liming

> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Wednesday, December 18, 2019 1:00 PM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Andy Shevchenko <andy@infradead.org>; Darren Hart <dvhart@infradead.org>; Vadim Pasternak <vadimp@mellanox.com>; David
> Woods <dwoods@mellanox.com>; Platform Driver <platform-driver-x86@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH v3] platform/mellanox: fix the mlx-bootctl sysfs
> 
> On Wed, Dec 18, 2019 at 5:25 PM Liming Sun <lsun@mellanox.com> wrote:
> >
> > This is a follow-up commit for the sysfs attributes to change
> > from DRIVER_ATTR to DEVICE_ATTR according to some initial comments.
> > In such case, it's better to point the sysfs path to the device
> > itself instead of the driver. The ABI document is also updated.
> >
> > Fixes: 79e29cb8fbc5 ("platform/mellanox: Add bootctl driver for Mellanox BlueField Soc")
> > Signed-off-by: Liming Sun <lsun@mellanox.com>
> 
> ...
> 
> > -ATTRIBUTE_GROUPS(mlxbf_bootctl);
> 
> What's wrong with above macro?
> 
> > +static const struct attribute_group mlxbf_bootctl_group = {
> > +       .attrs  = mlxbf_bootctl_attrs,
> > +};
> 
> ...
> 
> > +static const struct attribute_group *mlxbf_bootctl_dev_groups[] = {
> > +       &mlxbf_bootctl_group,
> > +       NULL
> > +};
> 
> --
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-12-18 18:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 19:23 [PATCH v1 1/1] platform/mellanox: fix the mlx-bootctl sysfs Liming Sun
2019-12-13 10:21 ` Andy Shevchenko
2019-12-13 15:22   ` Liming Sun
2019-12-13 15:21 ` [PATCH v2] " Liming Sun
2019-12-18 13:00   ` Andy Shevchenko
2019-12-18 15:26     ` Liming Sun
2019-12-18 15:24 ` [PATCH v3] " Liming Sun
2019-12-18 17:59   ` Andy Shevchenko
2019-12-18 18:36     ` Liming Sun
2019-12-18 18:35 ` [PATCH v4] " Liming Sun

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.