From: Stephen Boyd <swboyd@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev,
"Benson Leung" <bleung@chromium.org>,
chrome-platform@lists.linux.dev, linux-usb@vger.kernel.org,
"Pavan Holla" <pholla@chromium.org>,
"Abhishek Pandit-Subedi" <abhishekpandit@chromium.org>,
"Łukasz Bartosik" <ukaszb@chromium.org>
Subject: [PATCH 1/2] usb: typec: cros-ec-ucsi: Add newlines to printk messages
Date: Thu, 9 Jan 2025 14:06:52 -0800 [thread overview]
Message-ID: <20250109220655.1677506-2-swboyd@chromium.org> (raw)
In-Reply-To: <20250109220655.1677506-1-swboyd@chromium.org>
These printks need newlines. Add them and convert to dev_err_probe() in
cros_ucsi_probe() to simplify code.
Cc: Pavan Holla <pholla@chromium.org>
Cc: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: Łukasz Bartosik <ukaszb@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 28 ++++++++++++---------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
index db8324b71ee9..75646a8d55be 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -58,14 +58,14 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
int ret;
if (val_len > MAX_EC_DATA_SIZE) {
- dev_err(udata->dev, "Can't read %zu bytes. Too big.", val_len);
+ dev_err(udata->dev, "Can't read %zu bytes. Too big.\n", val_len);
return -EINVAL;
}
ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_GET,
&req, sizeof(req), val, val_len);
if (ret < 0) {
- dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d", ret);
+ dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d\n", ret);
return ret;
}
return 0;
@@ -99,7 +99,7 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_SET,
req, sizeof(ec_buf), NULL, 0);
if (ret < 0) {
- dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
+ dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d\n", ret);
return ret;
}
return 0;
@@ -161,7 +161,7 @@ static void cros_ucsi_write_timeout(struct work_struct *work)
if (cros_ucsi_read(udata->ucsi, UCSI_CCI, &cci, sizeof(cci))) {
dev_err(udata->dev,
- "Reading CCI failed; no write timeout recovery possible.");
+ "Reading CCI failed; no write timeout recovery possible.\n");
return;
}
@@ -173,7 +173,7 @@ static void cros_ucsi_write_timeout(struct work_struct *work)
msecs_to_jiffies(WRITE_TMO_MS));
else
dev_err(udata->dev,
- "PPM unresponsive - too many write timeouts.");
+ "PPM unresponsive - too many write timeouts.\n");
return;
}
@@ -208,7 +208,7 @@ static int cros_ucsi_event(struct notifier_block *nb,
if (!(host_event & PD_EVENT_PPM))
return NOTIFY_OK;
- dev_dbg(udata->dev, "UCSI notification received");
+ dev_dbg(udata->dev, "UCSI notification received\n");
flush_work(&udata->work);
schedule_work(&udata->work);
@@ -237,10 +237,8 @@ static int cros_ucsi_probe(struct platform_device *pdev)
udata->dev = dev;
udata->ec = ec_data->ec_dev;
- if (!udata->ec) {
- dev_err(dev, "couldn't find parent EC device");
- return -ENODEV;
- }
+ if (!udata->ec)
+ return dev_err_probe(dev, -ENODEV, "couldn't find parent EC device\n");
platform_set_drvdata(pdev, udata);
@@ -249,24 +247,22 @@ static int cros_ucsi_probe(struct platform_device *pdev)
init_completion(&udata->complete);
udata->ucsi = ucsi_create(dev, &cros_ucsi_ops);
- if (IS_ERR(udata->ucsi)) {
- dev_err(dev, "failed to allocate UCSI instance");
- return PTR_ERR(udata->ucsi);
- }
+ if (IS_ERR(udata->ucsi))
+ return dev_err_probe(dev, PTR_ERR(udata->ucsi), "failed to allocate UCSI instance\n");
ucsi_set_drvdata(udata->ucsi, udata);
udata->nb.notifier_call = cros_ucsi_event;
ret = cros_usbpd_register_notify(&udata->nb);
if (ret) {
- dev_err(dev, "failed to register notifier: error=%d", ret);
+ dev_err_probe(dev, ret, "failed to register notifier\n");
ucsi_destroy(udata->ucsi);
return ret;
}
ret = ucsi_register(udata->ucsi);
if (ret) {
- dev_err(dev, "failed to register UCSI: error=%d", ret);
+ dev_err_probe(dev, ret, "failed to register UCSI\n");
cros_ucsi_destroy(udata);
return ret;
}
--
https://chromeos.dev
next prev parent reply other threads:[~2025-01-09 22:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 22:06 [PATCH 0/2] usb: typec: cros-ec-ucsi: A couple small cleanups Stephen Boyd
2025-01-09 22:06 ` Stephen Boyd [this message]
2025-01-10 13:41 ` [PATCH 1/2] usb: typec: cros-ec-ucsi: Add newlines to printk messages Łukasz Bartosik
2025-01-09 22:06 ` [PATCH 2/2] usb: typec: cros-ec-ucsi: Mark cros_ucsi_ops static/const Stephen Boyd
2025-01-10 13:47 ` Łukasz Bartosik
2025-01-10 13:38 ` [PATCH 0/2] usb: typec: cros-ec-ucsi: A couple small cleanups Łukasz Bartosik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250109220655.1677506-2-swboyd@chromium.org \
--to=swboyd@chromium.org \
--cc=abhishekpandit@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=pholla@chromium.org \
--cc=ukaszb@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox