Skip to content

Commit 8ec7cac

Browse files
bebarinogregkh
authored andcommitted
usb: typec: cros-ec-ucsi: Add newlines to printk messages
These printks need newlines. Add them and convert to dev_err_probe() in cros_ucsi_probe() to simplify code. Cc: Pavan Holla <[email protected]> Cc: Abhishek Pandit-Subedi <[email protected]> Cc: Łukasz Bartosik <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Łukasz Bartosik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 653e11e commit 8ec7cac

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

drivers/usb/typec/ucsi/cros_ec_ucsi.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
5858
int ret;
5959

6060
if (val_len > MAX_EC_DATA_SIZE) {
61-
dev_err(udata->dev, "Can't read %zu bytes. Too big.", val_len);
61+
dev_err(udata->dev, "Can't read %zu bytes. Too big.\n", val_len);
6262
return -EINVAL;
6363
}
6464

6565
ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_GET,
6666
&req, sizeof(req), val, val_len);
6767
if (ret < 0) {
68-
dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d", ret);
68+
dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d\n", ret);
6969
return ret;
7070
}
7171
return 0;
@@ -99,7 +99,7 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
9999
ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_SET,
100100
req, sizeof(ec_buf), NULL, 0);
101101
if (ret < 0) {
102-
dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
102+
dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d\n", ret);
103103
return ret;
104104
}
105105
return 0;
@@ -161,7 +161,7 @@ static void cros_ucsi_write_timeout(struct work_struct *work)
161161

162162
if (cros_ucsi_read(udata->ucsi, UCSI_CCI, &cci, sizeof(cci))) {
163163
dev_err(udata->dev,
164-
"Reading CCI failed; no write timeout recovery possible.");
164+
"Reading CCI failed; no write timeout recovery possible.\n");
165165
return;
166166
}
167167

@@ -173,7 +173,7 @@ static void cros_ucsi_write_timeout(struct work_struct *work)
173173
msecs_to_jiffies(WRITE_TMO_MS));
174174
else
175175
dev_err(udata->dev,
176-
"PPM unresponsive - too many write timeouts.");
176+
"PPM unresponsive - too many write timeouts.\n");
177177

178178
return;
179179
}
@@ -208,7 +208,7 @@ static int cros_ucsi_event(struct notifier_block *nb,
208208
if (!(host_event & PD_EVENT_PPM))
209209
return NOTIFY_OK;
210210

211-
dev_dbg(udata->dev, "UCSI notification received");
211+
dev_dbg(udata->dev, "UCSI notification received\n");
212212
flush_work(&udata->work);
213213
schedule_work(&udata->work);
214214

@@ -237,10 +237,8 @@ static int cros_ucsi_probe(struct platform_device *pdev)
237237
udata->dev = dev;
238238

239239
udata->ec = ec_data->ec_dev;
240-
if (!udata->ec) {
241-
dev_err(dev, "couldn't find parent EC device");
242-
return -ENODEV;
243-
}
240+
if (!udata->ec)
241+
return dev_err_probe(dev, -ENODEV, "couldn't find parent EC device\n");
244242

245243
platform_set_drvdata(pdev, udata);
246244

@@ -249,24 +247,22 @@ static int cros_ucsi_probe(struct platform_device *pdev)
249247
init_completion(&udata->complete);
250248

251249
udata->ucsi = ucsi_create(dev, &cros_ucsi_ops);
252-
if (IS_ERR(udata->ucsi)) {
253-
dev_err(dev, "failed to allocate UCSI instance");
254-
return PTR_ERR(udata->ucsi);
255-
}
250+
if (IS_ERR(udata->ucsi))
251+
return dev_err_probe(dev, PTR_ERR(udata->ucsi), "failed to allocate UCSI instance\n");
256252

257253
ucsi_set_drvdata(udata->ucsi, udata);
258254

259255
udata->nb.notifier_call = cros_ucsi_event;
260256
ret = cros_usbpd_register_notify(&udata->nb);
261257
if (ret) {
262-
dev_err(dev, "failed to register notifier: error=%d", ret);
258+
dev_err_probe(dev, ret, "failed to register notifier\n");
263259
ucsi_destroy(udata->ucsi);
264260
return ret;
265261
}
266262

267263
ret = ucsi_register(udata->ucsi);
268264
if (ret) {
269-
dev_err(dev, "failed to register UCSI: error=%d", ret);
265+
dev_err_probe(dev, ret, "failed to register UCSI\n");
270266
cros_ucsi_destroy(udata);
271267
return ret;
272268
}

0 commit comments

Comments
 (0)