Skip to contentSkip to conversation

nvmem: qcom-spmi-sdam: Enable multiple devices

PATCH Superseded Guru Das Srinagesh 2 participants 3 messages Jul 14, 2020 – Jul 21, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: qcom-spmi-sdam: Enable multiple devices

Specifying the name of the nvmem device while registering it with the nvmem framework has the side effect of causing the second instance of a device using this driver to fail probe with the following error message:

sysfs: cannot create duplicate filename '/bus/nvmem/devices/spmi_sdam'

Removing the name allows the nvmem framework to assign a monotonically increasing integer id to each instance of this driver automatically, like so:

/sys/bus/nvmem/devices # ls
nvmem0 nvmem1 nvmem2

---
 drivers/nvmem/qcom-spmi-sdam.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvmem/qcom-spmi-sdam.c +1 -3
index 8682cda..6275f14 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
  */
 
 #include <linux/device.h>
@@ -140,8 +140,6 @@ static int sdam_probe(struct platform_device *pdev)
 	sdam->size = val * 32;
 
 	sdam->sdam_config.dev = &pdev->dev;
-	sdam->sdam_config.name = "spmi_sdam";
-	sdam->sdam_config.id = pdev->id;
 	sdam->sdam_config.owner = THIS_MODULE,
 	sdam->sdam_config.stride = 1;
 	sdam->sdam_config.word_size = 1;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
Quoted 31 lines · Guru Das Srinagesh

Specifying the name of the nvmem device while registering it with the nvmem framework has the side effect of causing the second instance of a device using this driver to fail probe with the following error message:

sysfs: cannot create duplicate filename '/bus/nvmem/devices/spmi_sdam'

Removing the name allows the nvmem framework to assign a monotonically increasing integer id to each instance of this driver automatically, like so:

/sys/bus/nvmem/devices # ls
nvmem0 nvmem1 nvmem2

---
  drivers/nvmem/qcom-spmi-sdam.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvmem/qcom-spmi-sdam.c +1 -1
index 8682cda..6275f14 100644
@@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0-only
  /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
   */
 
  #include <linux/device.h>

drivers/nvmem/qcom-spmi-sdam.c static int sdam_probe(struct platform_device *pdev) · line 144

Quoted 5 lines
drivers/nvmem/qcom-spmi-sdam.c +0 -2
@@ -140,8 +140,6 @@ static int sdam_probe(struct platform_device *pdev)
  	sdam->size = val * 32;
 
  	sdam->sdam_config.dev = &pdev->dev;
-	sdam->sdam_config.name = "spmi_sdam";
-	sdam->sdam_config.id = pdev->id;

Please use new flag NVMEM_DEVID_AUTO introduced in https://git.kernel.org/pub/scm/linux/kernel/git/srini/nvmem.git/commit/?h=for-next&id=93ac5fdba1eddc679e9694b64f2fa321317df988
instead of pdev->id, which should fix the issue.

--srini

Quoted 4 lines
drivers/nvmem/qcom-spmi-sdam.c +0 -0
  	sdam->sdam_config.owner = THIS_MODULE,
  	sdam->sdam_config.stride = 1;
  	sdam->sdam_config.word_size = 1;
#2 lore raw
Quoted 32 lines · Srinivas Kandagatla
Quoted 29 lines · Guru Das Srinagesh

Specifying the name of the nvmem device while registering it with the nvmem framework has the side effect of causing the second instance of a device using this driver to fail probe with the following error message:

sysfs: cannot create duplicate filename '/bus/nvmem/devices/spmi_sdam'

Removing the name allows the nvmem framework to assign a monotonically increasing integer id to each instance of this driver automatically, like so:

/sys/bus/nvmem/devices # ls
nvmem0 nvmem1 nvmem2

---
 drivers/nvmem/qcom-spmi-sdam.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/nvmem/qcom-spmi-sdam.c +1 -1
index 8682cda..6275f14 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2020 The Linux Foundation. All rights reserved.
  */
 #include <linux/device.h>
Quoted 8 lines

drivers/nvmem/qcom-spmi-sdam.c static int sdam_probe(struct platform_device *pdev) · line 143

Quoted 5 lines
drivers/nvmem/qcom-spmi-sdam.c +0 -2
@@ -140,8 +140,6 @@ static int sdam_probe(struct platform_device *pdev)
 	sdam->size = val * 32;
 	sdam->sdam_config.dev = &pdev->dev;
-	sdam->sdam_config.name = "spmi_sdam";
-	sdam->sdam_config.id = pdev->id;

Please use new flag NVMEM_DEVID_AUTO introduced in https://git.kernel.org/pub/scm/linux/kernel/git/srini/nvmem.git/commit/?h=for-next&id=93ac5fdba1eddc679e9694b64f2fa321317df988
instead of pdev->id, which should fix the issue.

Thank you for pointing this out, I've uploaded a v2 using this flag.

Thank you.

Guru Das.