Re: [PATCH] drivers/staging/media: Prefer using __func__ instead
From: Joe Perches
Date: Thu Jun 29 2017 - 09:30:32 EST
On Thu, 2017-06-29 at 16:59 +0530, Pushkar Jambhlekar wrote:
> Function name is hardcoded. replacing with __func__
Please run your proposed patches through checkpatch
before you send them.
> diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c
[]
> @@ -100,7 +100,7 @@ static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr,
> .buf = val, .len = 1} };
>
> if (i2c_transfer(adapter, msgs, 2) != 2) {
> - dev_err(&adapter->dev, "error in i2c_read_reg\n");
> + dev_err(&adapter->dev, "error in %s\n", __func__);
> return -1;
> }
> return 0;
> @@ -115,7 +115,7 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr,
> .buf = data, .len = n} };
>
> if (i2c_transfer(adapter, msgs, 2) != 2) {
> - dev_err(&adapter->dev, "error in i2c_read\n");
> + dev_err(&adapter->dev, "error in %s\n",__func__);
There is a missing space before __func__.
As well, the form for listing a function name
is generally:
print("%s: <error description>\n", __func__);
so ideally, these messages would be something like:
dev_err(&adapter->dev, "%s: i2c_transfer error\n", __func__);