* [PATCH v4 0/3] Add support for attaching a regulator to w1: ds2482
@ 2024-11-25 22:47 Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 1/3] dt-bindings: w1: ds2482: Add vcc-supply property Kryštof Černý via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Kryštof Černý via B4 Relay @ 2024-11-25 22:47 UTC (permalink / raw)
To: Krzysztof Kozlowski, Rob Herring, Conor Dooley, Stefan Wahren,
Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree,
Kryštof Černý,
Conor Dooley
Implemented changes requested in review.
Signed-off-by: Kryštof Černý <cleverline1mc@gmail.com>
---
Changes in v4:
- Using dev_err_probe() instead of dev_err() for the regulator error.
- Corrected patch order.
- Link to v3: https://lore.kernel.org/r/20241124-ds2482-add-reg-v3-0-806df39c9454@gmail.com
Changes in v3:
- Switched from regulator_enable() to devm_regulator_get_enable()
- Removed obvious comments.
- Link to v2: https://lore.kernel.org/r/20241122-ds2482-add-reg-v2-0-a5a03ee74da7@gmail.com
Changes in v2:
- Removed property description
- Changed commit message of binding commit
- Link to v1: https://lore.kernel.org/r/20241115-ds2482-add-reg-v1-0-cc84b9aba126@gmail.com
---
Kryštof Černý (3):
dt-bindings: w1: ds2482: Add vcc-supply property
w1: ds2482: Add regulator support
w1: ds2482: Fix datasheet URL
Documentation/devicetree/bindings/w1/maxim,ds2482.yaml | 2 ++
drivers/w1/masters/ds2482.c | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
---
base-commit: 6d59cab07b8d74d0f0422b750038123334f6ecc2
change-id: 20241111-ds2482-add-reg-fe13200ad7d6
Best regards,
--
Kryštof Černý <cleverline1mc@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/3] dt-bindings: w1: ds2482: Add vcc-supply property
2024-11-25 22:47 [PATCH v4 0/3] Add support for attaching a regulator to w1: ds2482 Kryštof Černý via B4 Relay
@ 2024-11-25 22:47 ` Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 2/3] w1: ds2482: Add regulator support Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 3/3] w1: ds2482: Fix datasheet URL Kryštof Černý via B4 Relay
2 siblings, 0 replies; 7+ messages in thread
From: Kryštof Černý via B4 Relay @ 2024-11-25 22:47 UTC (permalink / raw)
To: Krzysztof Kozlowski, Rob Herring, Conor Dooley, Stefan Wahren,
Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree,
Kryštof Černý,
Conor Dooley
From: Kryštof Černý <cleverline1mc@gmail.com>
ds2482 has a VCC pin, accepting 2.9-5.5 V.
Signed-off-by: Kryštof Černý <cleverline1mc@gmail.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
Documentation/devicetree/bindings/w1/maxim,ds2482.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/w1/maxim,ds2482.yaml b/Documentation/devicetree/bindings/w1/maxim,ds2482.yaml
index 422becc6e1fa8d58665c5586ebdc611cd0b2c760..fe6b3f9a3f8bbd00366c3e36aad3ffa72ec1a31f 100644
--- a/Documentation/devicetree/bindings/w1/maxim,ds2482.yaml
+++ b/Documentation/devicetree/bindings/w1/maxim,ds2482.yaml
@@ -25,6 +25,8 @@ properties:
reg:
maxItems: 1
+ vcc-supply: true
+
required:
- compatible
- reg
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 2/3] w1: ds2482: Add regulator support
2024-11-25 22:47 [PATCH v4 0/3] Add support for attaching a regulator to w1: ds2482 Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 1/3] dt-bindings: w1: ds2482: Add vcc-supply property Kryštof Černý via B4 Relay
@ 2024-11-25 22:47 ` Kryštof Černý via B4 Relay
2024-11-27 14:21 ` Kryštof Černý
2024-11-25 22:47 ` [PATCH v4 3/3] w1: ds2482: Fix datasheet URL Kryštof Černý via B4 Relay
2 siblings, 1 reply; 7+ messages in thread
From: Kryštof Černý via B4 Relay @ 2024-11-25 22:47 UTC (permalink / raw)
To: Krzysztof Kozlowski, Rob Herring, Conor Dooley, Stefan Wahren,
Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree, Kryštof Černý
From: Kryštof Černý <cleverline1mc@gmail.com>
Adds a support for attaching a supply regulator.
Signed-off-by: Kryštof Černý <cleverline1mc@gmail.com>
---
drivers/w1/masters/ds2482.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index a2ecbb863c57f38bffc8e3cd463db1940e603179..2e5bbe11d8a0cdabd12e89e22537423749e7f9ff 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -15,6 +15,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
+#include <linux/regulator/consumer.h>
#include <linux/w1.h>
@@ -445,6 +446,7 @@ static int ds2482_probe(struct i2c_client *client)
int err = -ENODEV;
int temp1;
int idx;
+ int ret;
if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
@@ -457,6 +459,10 @@ static int ds2482_probe(struct i2c_client *client)
goto exit;
}
+ ret = devm_regulator_get_enable(&client->dev, "vcc");
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "Failed to enable regulator\n");
+
data->client = client;
i2c_set_clientdata(client, data);
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 3/3] w1: ds2482: Fix datasheet URL
2024-11-25 22:47 [PATCH v4 0/3] Add support for attaching a regulator to w1: ds2482 Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 1/3] dt-bindings: w1: ds2482: Add vcc-supply property Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 2/3] w1: ds2482: Add regulator support Kryštof Černý via B4 Relay
@ 2024-11-25 22:47 ` Kryštof Černý via B4 Relay
2 siblings, 0 replies; 7+ messages in thread
From: Kryštof Černý via B4 Relay @ 2024-11-25 22:47 UTC (permalink / raw)
To: Krzysztof Kozlowski, Rob Herring, Conor Dooley, Stefan Wahren,
Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree, Kryštof Černý
From: Kryštof Černý <cleverline1mc@gmail.com>
Current link does redirect to wrong place.
Signed-off-by: Kryštof Černý <cleverline1mc@gmail.com>
---
drivers/w1/masters/ds2482.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index 2e5bbe11d8a0cdabd12e89e22537423749e7f9ff..52a437aa8be062def827aae012ace6b8cef58b3e 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -7,7 +7,7 @@
* It is a I2C to 1-wire bridge.
* There are two variations: -100 and -800, which have 1 or 8 1-wire ports.
* The complete datasheet can be obtained from MAXIM's website at:
- * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4382
+ * https://www.analog.com/en/products/ds2482-100.html
*/
#include <linux/module.h>
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/3] w1: ds2482: Add regulator support
2024-11-25 22:47 ` [PATCH v4 2/3] w1: ds2482: Add regulator support Kryštof Černý via B4 Relay
@ 2024-11-27 14:21 ` Kryštof Černý
2024-11-27 14:47 ` Stefan Wahren
2024-11-27 15:07 ` Krzysztof Kozlowski
0 siblings, 2 replies; 7+ messages in thread
From: Kryštof Černý @ 2024-11-27 14:21 UTC (permalink / raw)
To: Krzysztof Kozlowski, Rob Herring, Conor Dooley, Stefan Wahren,
Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree
I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
> @@ -457,6 +459,10 @@ static int ds2482_probe(struct i2c_client *client)
> goto exit;
> }
>
> + ret = devm_regulator_get_enable(&client->dev, "vcc");
> + if (ret)
> + return dev_err_probe(&client->dev, ret, "Failed to enable regulator\n");
This will cause a memory leak of `data`, I would refactor the driver a
bit in the next patch revision. Should I create a separate commit that
switches from kzalloc() to devm_kzalloc() or keep it in patch 2/3? The
separate commits way seems correct to me, so it is clearly
distinguished. Sorry that I missed it.
> +
> data->client = client;
> i2c_set_clientdata(client, data);
Best regards,
Kryštof Černý
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/3] w1: ds2482: Add regulator support
2024-11-27 14:21 ` Kryštof Černý
@ 2024-11-27 14:47 ` Stefan Wahren
2024-11-27 15:07 ` Krzysztof Kozlowski
1 sibling, 0 replies; 7+ messages in thread
From: Stefan Wahren @ 2024-11-27 14:47 UTC (permalink / raw)
To: Kryštof Černý,
Krzysztof Kozlowski, Rob Herring, Conor Dooley, Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree
Hi Kryštof,
Am 27.11.24 um 15:21 schrieb Kryštof Černý:
> I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
>> @@ -457,6 +459,10 @@ static int ds2482_probe(struct i2c_client *client)
>> goto exit;
>> }
>> + ret = devm_regulator_get_enable(&client->dev, "vcc");
>> + if (ret)
>> + return dev_err_probe(&client->dev, ret, "Failed to enable
>> regulator\n");
>
> This will cause a memory leak of `data`, I would refactor the driver a
> bit in the next patch revision. Should I create a separate commit that
> switches from kzalloc() to devm_kzalloc() or keep it in patch 2/3? The
> separate commits way seems correct to me, so it is clearly
> distinguished. Sorry that I missed it.
I'm not the maintainer, but i suggests to send a V5 and add a separate
commit to avoid this issue. The merge window is still open.
Best regards
>
>> +
>> data->client = client;
>> i2c_set_clientdata(client, data);
>
> Best regards,
> Kryštof Černý
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/3] w1: ds2482: Add regulator support
2024-11-27 14:21 ` Kryštof Černý
2024-11-27 14:47 ` Stefan Wahren
@ 2024-11-27 15:07 ` Krzysztof Kozlowski
1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-11-27 15:07 UTC (permalink / raw)
To: Kryštof Černý,
Rob Herring, Conor Dooley, Stefan Wahren, Stefan Wahren
Cc: Ben Gardner, linux-kernel, devicetree
On 27/11/2024 15:21, Kryštof Černý wrote:
> I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
>> @@ -457,6 +459,10 @@ static int ds2482_probe(struct i2c_client *client)
>> goto exit;
>> }
>>
>> + ret = devm_regulator_get_enable(&client->dev, "vcc");
>> + if (ret)
>> + return dev_err_probe(&client->dev, ret, "Failed to enable regulator\n");
>
> This will cause a memory leak of `data`, I would refactor the driver a
> bit in the next patch revision. Should I create a separate commit that
> switches from kzalloc() to devm_kzalloc() or keep it in patch 2/3? The
> separate commits way seems correct to me, so it is clearly
> distinguished. Sorry that I missed it.
Separate commit, please.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-27 15:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-25 22:47 [PATCH v4 0/3] Add support for attaching a regulator to w1: ds2482 Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 1/3] dt-bindings: w1: ds2482: Add vcc-supply property Kryštof Černý via B4 Relay
2024-11-25 22:47 ` [PATCH v4 2/3] w1: ds2482: Add regulator support Kryštof Černý via B4 Relay
2024-11-27 14:21 ` Kryštof Černý
2024-11-27 14:47 ` Stefan Wahren
2024-11-27 15:07 ` Krzysztof Kozlowski
2024-11-25 22:47 ` [PATCH v4 3/3] w1: ds2482: Fix datasheet URL Kryštof Černý via B4 Relay
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®