2024-04-30 08:49:47

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 00/11] nvmem: patches(set 1) for 6.10

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

Here are few patches in nvmem for 6.10 that includes
- few driver owner related cleanups by Krzysztof
- switch to device_add_groups
- add support for SC8280XP
- few very minor updates.

Can you please queue them up for 6.10.

Thanks,
Srini


MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

David Collins (1):
dt-bindings: nvmem: qcom,spmi-sdam: update maintainer

Greg Kroah-Hartman (1):
nvmem: core: switch to use device_add_groups()

Konrad Dybcio (1):
dt-bindings: nvmem: Add compatible for SC8280XP

Krzysztof Kozlowski (5):
nvmem: layouts: store owner from modules with
nvmem_layout_driver_register()
nvmem: layouts: onie-tlv: drop driver owner initialization
nvmem: layouts: sl28vpd: drop driver owner initialization
nvmem: sc27xx: fix module autoloading
nvmem: sprd: fix module autoloading

Mukesh Ojha (2):
dt-bindings: nvmem: Add compatible for sm8450, sm8550 and sm8650
nvmem: meson-mx-efuse: Remove nvmem_device from efuse struct

Uwe Kleine-König (1):
nvmem: lpc18xx_eeprom: Convert to platform remove callback returning
void

Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 4 ++++
Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml | 2 +-
drivers/nvmem/core.c | 2 +-
drivers/nvmem/layouts.c | 6 ++++--
drivers/nvmem/layouts/onie-tlv.c | 1 -
drivers/nvmem/layouts/sl28vpd.c | 1 -
drivers/nvmem/lpc18xx_eeprom.c | 6 ++----
drivers/nvmem/meson-mx-efuse.c | 6 +++---
drivers/nvmem/sc27xx-efuse.c | 1 +
drivers/nvmem/sprd-efuse.c | 1 +
include/linux/nvmem-provider.h | 5 ++++-
11 files changed, 21 insertions(+), 14 deletions(-)

--
2.25.1



2024-04-30 08:49:52

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 01/11] nvmem: layouts: store owner from modules with nvmem_layout_driver_register()

From: Krzysztof Kozlowski <[email protected]>

Modules registering driver with nvmem_layout_driver_register() might
forget to set .owner field. The field is used by some of other kernel
parts for reference counting (try_module_get()), so it is expected that
drivers will set it.

Solve the problem by moving this task away from the drivers to the core
code, just like we did for platform_driver in
commit 9447057eaff8 ("platform_device: use a macro instead of
platform_driver_register").

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Michael Walle <[email protected]>
Reviewed-by: Miquel Raynal <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/layouts.c | 6 ++++--
include/linux/nvmem-provider.h | 5 ++++-
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/layouts.c b/drivers/nvmem/layouts.c
index 8b5e2de138eb..64dc7013a098 100644
--- a/drivers/nvmem/layouts.c
+++ b/drivers/nvmem/layouts.c
@@ -52,13 +52,15 @@ static const struct bus_type nvmem_layout_bus_type = {
.remove = nvmem_layout_bus_remove,
};

-int nvmem_layout_driver_register(struct nvmem_layout_driver *drv)
+int __nvmem_layout_driver_register(struct nvmem_layout_driver *drv,
+ struct module *owner)
{
drv->driver.bus = &nvmem_layout_bus_type;
+ drv->driver.owner = owner;

return driver_register(&drv->driver);
}
-EXPORT_SYMBOL_GPL(nvmem_layout_driver_register);
+EXPORT_SYMBOL_GPL(__nvmem_layout_driver_register);

void nvmem_layout_driver_unregister(struct nvmem_layout_driver *drv)
{
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index f0ba0e03218f..3ebeaa0ded00 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -199,7 +199,10 @@ int nvmem_add_one_cell(struct nvmem_device *nvmem,
int nvmem_layout_register(struct nvmem_layout *layout);
void nvmem_layout_unregister(struct nvmem_layout *layout);

-int nvmem_layout_driver_register(struct nvmem_layout_driver *drv);
+#define nvmem_layout_driver_register(drv) \
+ __nvmem_layout_driver_register(drv, THIS_MODULE)
+int __nvmem_layout_driver_register(struct nvmem_layout_driver *drv,
+ struct module *owner);
void nvmem_layout_driver_unregister(struct nvmem_layout_driver *drv);
#define module_nvmem_layout_driver(__nvmem_layout_driver) \
module_driver(__nvmem_layout_driver, nvmem_layout_driver_register, \
--
2.25.1


2024-04-30 08:50:06

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 02/11] nvmem: layouts: onie-tlv: drop driver owner initialization

From: Krzysztof Kozlowski <[email protected]>

Core in nvmem_layout_driver_register() already sets the .owner, so
driver does not need to.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Michael Walle <[email protected]>
Acked-by: Miquel Raynal <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/layouts/onie-tlv.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-tlv.c
index 9d2ad5f2dc10..0967a32319a2 100644
--- a/drivers/nvmem/layouts/onie-tlv.c
+++ b/drivers/nvmem/layouts/onie-tlv.c
@@ -247,7 +247,6 @@ MODULE_DEVICE_TABLE(of, onie_tlv_of_match_table);

static struct nvmem_layout_driver onie_tlv_layout = {
.driver = {
- .owner = THIS_MODULE,
.name = "onie-tlv-layout",
.of_match_table = onie_tlv_of_match_table,
},
--
2.25.1


2024-04-30 08:50:22

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 03/11] nvmem: layouts: sl28vpd: drop driver owner initialization

From: Krzysztof Kozlowski <[email protected]>

Core in nvmem_layout_driver_register() already sets the .owner, so
driver does not need to.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Michael Walle <[email protected]>
Reviewed-by: Miquel Raynal <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/layouts/sl28vpd.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vpd.c
index 53fa50f17dca..e93b020b0836 100644
--- a/drivers/nvmem/layouts/sl28vpd.c
+++ b/drivers/nvmem/layouts/sl28vpd.c
@@ -156,7 +156,6 @@ MODULE_DEVICE_TABLE(of, sl28vpd_of_match_table);

static struct nvmem_layout_driver sl28vpd_layout = {
.driver = {
- .owner = THIS_MODULE,
.name = "kontron-sl28vpd-layout",
.of_match_table = sl28vpd_of_match_table,
},
--
2.25.1


2024-04-30 08:50:34

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 04/11] nvmem: sc27xx: fix module autoloading

From: Krzysztof Kozlowski <[email protected]>

Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded
based on the alias from of_device_id table.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/sc27xx-efuse.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/nvmem/sc27xx-efuse.c b/drivers/nvmem/sc27xx-efuse.c
index bff27011f4ff..4e2ffefac96c 100644
--- a/drivers/nvmem/sc27xx-efuse.c
+++ b/drivers/nvmem/sc27xx-efuse.c
@@ -262,6 +262,7 @@ static const struct of_device_id sc27xx_efuse_of_match[] = {
{ .compatible = "sprd,sc2730-efuse", .data = &sc2730_edata},
{ }
};
+MODULE_DEVICE_TABLE(of, sc27xx_efuse_of_match);

static struct platform_driver sc27xx_efuse_driver = {
.probe = sc27xx_efuse_probe,
--
2.25.1


2024-04-30 08:50:45

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 05/11] nvmem: sprd: fix module autoloading

From: Krzysztof Kozlowski <[email protected]>

Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded
based on the alias from of_device_id table.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/sprd-efuse.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c
index bb3105f3291f..1a7e4e5d8b86 100644
--- a/drivers/nvmem/sprd-efuse.c
+++ b/drivers/nvmem/sprd-efuse.c
@@ -426,6 +426,7 @@ static const struct of_device_id sprd_efuse_of_match[] = {
{ .compatible = "sprd,ums312-efuse", .data = &ums312_data },
{ }
};
+MODULE_DEVICE_TABLE(of, sprd_efuse_of_match);

static struct platform_driver sprd_efuse_driver = {
.probe = sprd_efuse_probe,
--
2.25.1


2024-04-30 08:51:03

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 06/11] nvmem: core: switch to use device_add_groups()

From: Greg Kroah-Hartman <[email protected]>

devm_device_add_groups() is being removed from the kernel, so move the
nvmem driver to use device_add_groups() instead. The logic is
identical, when the device is removed the driver core will properly
clean up and remove the groups, and the memory used by the attribute
groups will be freed because it was created with dev_* calls, so this is
functionally identical overall.

Cc: Srinivas Kandagatla <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 2c6b99402df8..e1ec3b7200d7 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -478,7 +478,7 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)

nvmem_cells_group.bin_attrs = cells_attrs;

- ret = devm_device_add_groups(&nvmem->dev, nvmem_cells_groups);
+ ret = device_add_groups(&nvmem->dev, nvmem_cells_groups);
if (ret)
goto unlock_mutex;

--
2.25.1


2024-04-30 08:51:12

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 07/11] nvmem: lpc18xx_eeprom: Convert to platform remove callback returning void

From: Uwe Kleine-König <[email protected]>

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <[email protected]>
Acked-by: Vladimir Zapolskiy <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/lpc18xx_eeprom.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/nvmem/lpc18xx_eeprom.c b/drivers/nvmem/lpc18xx_eeprom.c
index a0275b29afd5..a73acc7377d2 100644
--- a/drivers/nvmem/lpc18xx_eeprom.c
+++ b/drivers/nvmem/lpc18xx_eeprom.c
@@ -249,13 +249,11 @@ static int lpc18xx_eeprom_probe(struct platform_device *pdev)
return ret;
}

-static int lpc18xx_eeprom_remove(struct platform_device *pdev)
+static void lpc18xx_eeprom_remove(struct platform_device *pdev)
{
struct lpc18xx_eeprom_dev *eeprom = platform_get_drvdata(pdev);

clk_disable_unprepare(eeprom->clk);
-
- return 0;
}

static const struct of_device_id lpc18xx_eeprom_of_match[] = {
@@ -266,7 +264,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_eeprom_of_match);

static struct platform_driver lpc18xx_eeprom_driver = {
.probe = lpc18xx_eeprom_probe,
- .remove = lpc18xx_eeprom_remove,
+ .remove_new = lpc18xx_eeprom_remove,
.driver = {
.name = "lpc18xx-eeprom",
.of_match_table = lpc18xx_eeprom_of_match,
--
2.25.1


2024-04-30 08:51:23

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 08/11] dt-bindings: nvmem: Add compatible for sm8450, sm8550 and sm8650

From: Mukesh Ojha <[email protected]>

Document QFPROM compatible for sm8450, sm8550 and sm8650 SoCs.

Signed-off-by: Mukesh Ojha <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
index 8c8f05d9eaf1..aed90aff3593 100644
--- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
+++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
@@ -42,6 +42,9 @@ properties:
- qcom,sm6375-qfprom
- qcom,sm8150-qfprom
- qcom,sm8250-qfprom
+ - qcom,sm8450-qfprom
+ - qcom,sm8550-qfprom
+ - qcom,sm8650-qfprom
- const: qcom,qfprom

reg:
--
2.25.1


2024-04-30 08:51:49

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 10/11] dt-bindings: nvmem: Add compatible for SC8280XP

From: Konrad Dybcio <[email protected]>

Document the QFPROM block found on SC8280XP.

Signed-off-by: Konrad Dybcio <[email protected]>
Acked-by: Rob Herring <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
index aed90aff3593..80845c722ae4 100644
--- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
+++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
@@ -34,6 +34,7 @@ properties:
- qcom,qcs404-qfprom
- qcom,sc7180-qfprom
- qcom,sc7280-qfprom
+ - qcom,sc8280xp-qfprom
- qcom,sdm630-qfprom
- qcom,sdm670-qfprom
- qcom,sdm845-qfprom
--
2.25.1


2024-04-30 08:52:38

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 11/11] nvmem: meson-mx-efuse: Remove nvmem_device from efuse struct

From: Mukesh Ojha <[email protected]>

nvmem_device is used at one place while registering nvmem
device and it is not required to be present in efuse struct
for just this purpose.

Drop nvmem_device and manage with nvmem device stack variable.

Signed-off-by: Mukesh Ojha <[email protected]>
Reviewed-by: Martin Blumenstingl <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/meson-mx-efuse.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/meson-mx-efuse.c b/drivers/nvmem/meson-mx-efuse.c
index 3ff04d5ca8f8..8a16f5f02657 100644
--- a/drivers/nvmem/meson-mx-efuse.c
+++ b/drivers/nvmem/meson-mx-efuse.c
@@ -43,7 +43,6 @@ struct meson_mx_efuse_platform_data {
struct meson_mx_efuse {
void __iomem *base;
struct clk *core_clk;
- struct nvmem_device *nvmem;
struct nvmem_config config;
};

@@ -193,6 +192,7 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
{
const struct meson_mx_efuse_platform_data *drvdata;
struct meson_mx_efuse *efuse;
+ struct nvmem_device *nvmem;

drvdata = of_device_get_match_data(&pdev->dev);
if (!drvdata)
@@ -223,9 +223,9 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
return PTR_ERR(efuse->core_clk);
}

- efuse->nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);
+ nvmem = devm_nvmem_register(&pdev->dev, &efuse->config);

- return PTR_ERR_OR_ZERO(efuse->nvmem);
+ return PTR_ERR_OR_ZERO(nvmem);
}

static struct platform_driver meson_mx_efuse_driver = {
--
2.25.1


2024-04-30 08:54:36

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 09/11] dt-bindings: nvmem: qcom,spmi-sdam: update maintainer

From: David Collins <[email protected]>

Emails to Shyam bounce (reason: 585 5.1.1 <[email protected]>:
Recipient address rejected: undeliverable address: No such user here.)
so change the maintainer to be me. I work on qcom,spmi-sdam as well
as other PMIC peripheral devices.

Signed-off-by: David Collins <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml b/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml
index 068bedf5dbc9..5d7be0b34536 100644
--- a/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml
+++ b/Documentation/devicetree/bindings/nvmem/qcom,spmi-sdam.yaml
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm Technologies, Inc. SPMI SDAM

maintainers:
- - Shyam Kumar Thella <[email protected]>
+ - David Collins <[email protected]>

description: |
The SDAM provides scratch register space for the PMIC clients. This
--
2.25.1