[v4,4/6] can: etas_es58x: remove es58x_get_product_info()
Commit Message
Now that the product information is available under devlink, no more
need to print them in the kernel log. Remove es58x_get_product_info().
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 52 ++-------------------
1 file changed, 3 insertions(+), 49 deletions(-)
Comments
On Sun, Nov 27, 2022 at 01:22:09AM +0900, Vincent Mailhol wrote:
> Now that the product information is available under devlink, no more
> need to print them in the kernel log. Remove es58x_get_product_info().
>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
There is a slim chance this will break something paring the kernel
log, but you are not really supposed to do that.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
On Mon. 28 Nov. 2022 at 22:47, Andrew Lunn <andrew@lunn.ch> wrote:
> On Sun, Nov 27, 2022 at 01:22:09AM +0900, Vincent Mailhol wrote:
> > Now that the product information is available under devlink, no more
> > need to print them in the kernel log. Remove es58x_get_product_info().
> >
> > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
>
> There is a slim chance this will break something paring the kernel
> log, but you are not really supposed to do that.
Greg made it clear that this should disappear:
https://lore.kernel.org/linux-can/Y2YdH4dd8u%2FeUEXg@kroah.com/
and I agree.
I do not recognize the kernel log as being a stable interface to the
userland that we should not break.
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Thank you!
@@ -2120,48 +2120,6 @@ static void es58x_free_netdevs(struct es58x_device *es58x_dev)
}
}
-/**
- * es58x_get_product_info() - Get the product information and print them.
- * @es58x_dev: ES58X device.
- *
- * Do a synchronous call to get the product information.
- *
- * Return: zero on success, errno when any error occurs.
- */
-static int es58x_get_product_info(struct es58x_device *es58x_dev)
-{
- struct usb_device *udev = es58x_dev->udev;
- const int es58x_prod_info_idx = 6;
- /* Empirical tests show a prod_info length of maximum 83,
- * below should be more than enough.
- */
- const size_t prod_info_len = 127;
- char *prod_info;
- int ret;
-
- prod_info = kmalloc(prod_info_len, GFP_KERNEL);
- if (!prod_info)
- return -ENOMEM;
-
- ret = usb_string(udev, es58x_prod_info_idx, prod_info, prod_info_len);
- if (ret < 0) {
- dev_err(es58x_dev->dev,
- "%s: Could not read the product info: %pe\n",
- __func__, ERR_PTR(ret));
- goto out_free;
- }
- if (ret >= prod_info_len - 1) {
- dev_warn(es58x_dev->dev,
- "%s: Buffer is too small, result might be truncated\n",
- __func__);
- }
- dev_info(es58x_dev->dev, "Product info: %s\n", prod_info);
-
- out_free:
- kfree(prod_info);
- return ret < 0 ? ret : 0;
-}
-
/**
* es58x_init_es58x_dev() - Initialize the ES58X device.
* @intf: USB interface.
@@ -2240,28 +2198,24 @@ static int es58x_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct es58x_device *es58x_dev;
- int ch_idx, ret;
+ int ch_idx;
es58x_dev = es58x_init_es58x_dev(intf, id->driver_info);
if (IS_ERR(es58x_dev))
return PTR_ERR(es58x_dev);
- ret = es58x_get_product_info(es58x_dev);
- if (ret)
- return ret;
-
es58x_parse_product_info(es58x_dev);
devlink_register(priv_to_devlink(es58x_dev));
for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) {
- ret = es58x_init_netdev(es58x_dev, ch_idx);
+ int ret = es58x_init_netdev(es58x_dev, ch_idx);
if (ret) {
es58x_free_netdevs(es58x_dev);
return ret;
}
}
- return ret;
+ return 0;
}
/**