* [PATCH 1/3] e1000: mtd: remove needless error checking for device parameter
@ 2024-07-01 7:35 Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 2/3] PWM: core: " Ahmad Fatoum
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2024-07-01 7:35 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The invm device is specifically created for the EEPROM, so adding a
parameter should not result in a name clash.
This leaves only -ENOMEM as possible error. As the driver is usable
without EEPROM being writable, don't propagate the error.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/net/e1000/mtd.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/e1000/mtd.c b/drivers/net/e1000/mtd.c
index 50883fc2a602..b2643dcf4340 100644
--- a/drivers/net/e1000/mtd.c
+++ b/drivers/net/e1000/mtd.c
@@ -702,7 +702,6 @@ static int e1000_register_invm(struct e1000_hw *hw)
{
int ret;
u16 word;
- struct param_d *p;
if (e1000_eeprom_valid(hw)) {
ret = e1000_read_eeprom(hw, 0x0a, 1, &word);
@@ -732,15 +731,10 @@ static int e1000_register_invm(struct e1000_hw *hw)
return ret;
}
- p = dev_add_param_int(&hw->invm.dev, "lock", e1000_invm_set_lock,
+ dev_add_param_int(&hw->invm.dev, "lock", e1000_invm_set_lock,
NULL, &hw->invm.line, "%u", hw);
- if (IS_ERR(p)) {
- unregister_device(&hw->invm.dev);
- devfs_remove(&hw->invm.cdev);
- ret = PTR_ERR(p);
- }
- return ret;
+ return 0;
}
/*
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] PWM: core: remove needless error checking for device parameter
2024-07-01 7:35 [PATCH 1/3] e1000: mtd: remove needless error checking for device parameter Ahmad Fatoum
@ 2024-07-01 7:35 ` Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 3/3] fpga: bridge: " Ahmad Fatoum
2024-07-01 9:33 ` [PATCH 1/3] e1000: mtd: " Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2024-07-01 7:35 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The PWM device is specifically created for purposes of the PWM
framework. There should thus be no naming clashes and -ENOMEM
is not a fatal error there either, because the PWM C API is
still usable without the device parameters.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/pwm/core.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 69724e1a5c26..4dd18d9446aa 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -94,7 +94,6 @@ static int set_enable(struct param_d *p, void *priv)
int pwmchip_add(struct pwm_chip *chip)
{
struct pwm_device *pwm;
- struct param_d *p;
int ret;
if (!chip->devname)
@@ -117,24 +116,18 @@ int pwmchip_add(struct pwm_chip *chip)
list_add_tail(&pwm->node, &pwm_list);
- p = dev_add_param_uint32(&pwm->dev, "duty_ns", apply_params,
- NULL, &pwm->params.duty_cycle, "%u", pwm);
- if (IS_ERR(p))
- return PTR_ERR(p);
+ dev_add_param_uint32(&pwm->dev, "duty_ns", apply_params,
+ NULL, &pwm->params.duty_cycle, "%u", pwm);
- p = dev_add_param_uint32(&pwm->dev, "period_ns", apply_params,
- NULL, &pwm->params.period, "%u", pwm);
- if (IS_ERR(p))
- return PTR_ERR(p);
+ dev_add_param_uint32(&pwm->dev, "period_ns", apply_params,
+ NULL, &pwm->params.period, "%u", pwm);
- p = dev_add_param_bool(&pwm->dev, "enable", set_enable,
- NULL, &pwm->params.enabled, pwm);
- if (IS_ERR(p))
- return PTR_ERR(p);
+ dev_add_param_bool(&pwm->dev, "enable", set_enable,
+ NULL, &pwm->params.enabled, pwm);
- p = dev_add_param_bool(&pwm->dev, "inverted", apply_params,
- NULL, &pwm->params.polarity, pwm);
- return PTR_ERR_OR_ZERO(p);
+ dev_add_param_bool(&pwm->dev, "inverted", apply_params,
+ NULL, &pwm->params.polarity, pwm);
+ return 0;
}
EXPORT_SYMBOL_GPL(pwmchip_add);
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] fpga: bridge: remove needless error checking for device parameter
2024-07-01 7:35 [PATCH 1/3] e1000: mtd: remove needless error checking for device parameter Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 2/3] PWM: core: " Ahmad Fatoum
@ 2024-07-01 7:35 ` Ahmad Fatoum
2024-07-01 9:33 ` [PATCH 1/3] e1000: mtd: " Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2024-07-01 7:35 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The bridge device is specifically created for purposes of the FPGA
bridge framework. There should thus be no naming clashes and
-ENOMEM is not a fatal error there either, because the PWM C API
is still usable without the device parameters.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/fpga/fpga-bridge.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 5db24cb5bd74..0ca8a2b513e9 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -183,7 +183,6 @@ int fpga_bridge_register(struct device *dev, const char *name,
const struct fpga_bridge_ops *br_ops, void *priv)
{
struct fpga_bridge *bridge;
- struct param_d *p;
int ret = 0;
if (!name || !strlen(name)) {
@@ -213,10 +212,8 @@ int fpga_bridge_register(struct device *dev, const char *name,
dev->priv = bridge;
bridge->enable = 0;
- p = dev_add_param_bool(&bridge->dev, "enable", set_enable,
- NULL, &bridge->enable, bridge);
- if (IS_ERR(p))
- return PTR_ERR(p);
+ dev_add_param_bool(&bridge->dev, "enable", set_enable,
+ NULL, &bridge->enable, bridge);
of_platform_populate(dev->of_node, NULL, dev);
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] e1000: mtd: remove needless error checking for device parameter
2024-07-01 7:35 [PATCH 1/3] e1000: mtd: remove needless error checking for device parameter Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 2/3] PWM: core: " Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 3/3] fpga: bridge: " Ahmad Fatoum
@ 2024-07-01 9:33 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-07-01 9:33 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 01 Jul 2024 09:35:24 +0200, Ahmad Fatoum wrote:
> The invm device is specifically created for the EEPROM, so adding a
> parameter should not result in a name clash.
>
> This leaves only -ENOMEM as possible error. As the driver is usable
> without EEPROM being writable, don't propagate the error.
>
>
> [...]
Applied, thanks!
[1/3] e1000: mtd: remove needless error checking for device parameter
https://git.pengutronix.de/cgit/barebox/commit/?id=580b39673a36 (link may not be stable)
[2/3] PWM: core: remove needless error checking for device parameter
https://git.pengutronix.de/cgit/barebox/commit/?id=27fef37a0792 (link may not be stable)
[3/3] fpga: bridge: remove needless error checking for device parameter
https://git.pengutronix.de/cgit/barebox/commit/?id=0c64cff18f95 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-01 9:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-01 7:35 [PATCH 1/3] e1000: mtd: remove needless error checking for device parameter Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 2/3] PWM: core: " Ahmad Fatoum
2024-07-01 7:35 ` [PATCH 3/3] fpga: bridge: " Ahmad Fatoum
2024-07-01 9:33 ` [PATCH 1/3] e1000: mtd: " Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox