* [PATCH] power: supply: cros_usbpd: Remove dev_err() getting the number of ports
@ 2019-11-29 21:59 Enric Balletbo i Serra
2019-11-29 22:02 ` Guenter Roeck
2019-12-19 1:00 ` Sebastian Reichel
0 siblings, 2 replies; 3+ messages in thread
From: Enric Balletbo i Serra @ 2019-11-29 21:59 UTC (permalink / raw)
To: linux-kernel
Cc: Collabora Kernel ML, groeck, bleung, dtor, fparent, linux-pm,
Sebastian Reichel
When a device has no support to get the charger number of ports, it
doesn't have to result in a dev_err(), print saying "Could not get
charger port count" using a dev_info() would suffice. In such case,
the dev_info() message is already printed but the dev_err() is annoying,
specially, on those devices that doesn't support the command. So remove
the dev_err().
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/power/supply/cros_usbpd-charger.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c
index 6cc7c3910e09..ffad9ee03a68 100644
--- a/drivers/power/supply/cros_usbpd-charger.c
+++ b/drivers/power/supply/cros_usbpd-charger.c
@@ -132,11 +132,8 @@ static int cros_usbpd_charger_get_num_ports(struct charger_data *charger)
ret = cros_usbpd_charger_ec_command(charger, 0,
EC_CMD_CHARGE_PORT_COUNT,
NULL, 0, &resp, sizeof(resp));
- if (ret < 0) {
- dev_err(charger->dev,
- "Unable to get the number of ports (err:0x%x)\n", ret);
+ if (ret < 0)
return ret;
- }
return resp.port_count;
}
@@ -148,11 +145,8 @@ static int cros_usbpd_charger_get_usbpd_num_ports(struct charger_data *charger)
ret = cros_usbpd_charger_ec_command(charger, 0, EC_CMD_USB_PD_PORTS,
NULL, 0, &resp, sizeof(resp));
- if (ret < 0) {
- dev_err(charger->dev,
- "Unable to get the number or ports (err:0x%x)\n", ret);
+ if (ret < 0)
return ret;
- }
return resp.num_ports;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: cros_usbpd: Remove dev_err() getting the number of ports
2019-11-29 21:59 [PATCH] power: supply: cros_usbpd: Remove dev_err() getting the number of ports Enric Balletbo i Serra
@ 2019-11-29 22:02 ` Guenter Roeck
2019-12-19 1:00 ` Sebastian Reichel
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-11-29 22:02 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: linux-kernel, Collabora Kernel ML, Guenter Roeck, Benson Leung,
Dmitry Torokhov, fparent, Linux PM list, Sebastian Reichel
On Fri, Nov 29, 2019 at 1:59 PM Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
>
> When a device has no support to get the charger number of ports, it
> doesn't have to result in a dev_err(), print saying "Could not get
> charger port count" using a dev_info() would suffice. In such case,
> the dev_info() message is already printed but the dev_err() is annoying,
> specially, on those devices that doesn't support the command. So remove
> the dev_err().
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
> ---
>
> drivers/power/supply/cros_usbpd-charger.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c
> index 6cc7c3910e09..ffad9ee03a68 100644
> --- a/drivers/power/supply/cros_usbpd-charger.c
> +++ b/drivers/power/supply/cros_usbpd-charger.c
> @@ -132,11 +132,8 @@ static int cros_usbpd_charger_get_num_ports(struct charger_data *charger)
> ret = cros_usbpd_charger_ec_command(charger, 0,
> EC_CMD_CHARGE_PORT_COUNT,
> NULL, 0, &resp, sizeof(resp));
> - if (ret < 0) {
> - dev_err(charger->dev,
> - "Unable to get the number of ports (err:0x%x)\n", ret);
> + if (ret < 0)
> return ret;
> - }
>
> return resp.port_count;
> }
> @@ -148,11 +145,8 @@ static int cros_usbpd_charger_get_usbpd_num_ports(struct charger_data *charger)
>
> ret = cros_usbpd_charger_ec_command(charger, 0, EC_CMD_USB_PD_PORTS,
> NULL, 0, &resp, sizeof(resp));
> - if (ret < 0) {
> - dev_err(charger->dev,
> - "Unable to get the number or ports (err:0x%x)\n", ret);
> + if (ret < 0)
> return ret;
> - }
>
> return resp.num_ports;
> }
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: cros_usbpd: Remove dev_err() getting the number of ports
2019-11-29 21:59 [PATCH] power: supply: cros_usbpd: Remove dev_err() getting the number of ports Enric Balletbo i Serra
2019-11-29 22:02 ` Guenter Roeck
@ 2019-12-19 1:00 ` Sebastian Reichel
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2019-12-19 1:00 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: linux-kernel, Collabora Kernel ML, groeck, bleung, dtor, fparent,
linux-pm
[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]
Hi,
On Fri, Nov 29, 2019 at 10:59:16PM +0100, Enric Balletbo i Serra wrote:
> When a device has no support to get the charger number of ports, it
> doesn't have to result in a dev_err(), print saying "Could not get
> charger port count" using a dev_info() would suffice. In such case,
> the dev_info() message is already printed but the dev_err() is annoying,
> specially, on those devices that doesn't support the command. So remove
> the dev_err().
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
Thanks, queued to power-supply's for-next branch.
-- Sebastian
>
> drivers/power/supply/cros_usbpd-charger.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c
> index 6cc7c3910e09..ffad9ee03a68 100644
> --- a/drivers/power/supply/cros_usbpd-charger.c
> +++ b/drivers/power/supply/cros_usbpd-charger.c
> @@ -132,11 +132,8 @@ static int cros_usbpd_charger_get_num_ports(struct charger_data *charger)
> ret = cros_usbpd_charger_ec_command(charger, 0,
> EC_CMD_CHARGE_PORT_COUNT,
> NULL, 0, &resp, sizeof(resp));
> - if (ret < 0) {
> - dev_err(charger->dev,
> - "Unable to get the number of ports (err:0x%x)\n", ret);
> + if (ret < 0)
> return ret;
> - }
>
> return resp.port_count;
> }
> @@ -148,11 +145,8 @@ static int cros_usbpd_charger_get_usbpd_num_ports(struct charger_data *charger)
>
> ret = cros_usbpd_charger_ec_command(charger, 0, EC_CMD_USB_PD_PORTS,
> NULL, 0, &resp, sizeof(resp));
> - if (ret < 0) {
> - dev_err(charger->dev,
> - "Unable to get the number or ports (err:0x%x)\n", ret);
> + if (ret < 0)
> return ret;
> - }
>
> return resp.num_ports;
> }
> --
> 2.20.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-19 1:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-29 21:59 [PATCH] power: supply: cros_usbpd: Remove dev_err() getting the number of ports Enric Balletbo i Serra
2019-11-29 22:02 ` Guenter Roeck
2019-12-19 1:00 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).