Re: [PATCH v6 1/8] i2c: wmt: create wmt_i2c_init for general init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2024/1/3 20:56, Andi Shyti wrote:
Hi Hans,

On Fri, Dec 29, 2023 at 02:30:32PM +0800, Hans Hu wrote:
v4->v5:
	add previous prototype 'static' for wmt_i2c_init().

Some common initialization actions are put in the function
wmt_i2c_init(), which is convenient to share with zhaoxin.

Signed-off-by: Hans Hu <hanshu-oc@xxxxxxxxxxx>
---
  drivers/i2c/busses/i2c-wmt.c | 67 +++++++++++++++++++-----------------
  1 file changed, 36 insertions(+), 31 deletions(-)

diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c
index ec2a8da134e5..f1888f100d83 100644
--- a/drivers/i2c/busses/i2c-wmt.c
+++ b/drivers/i2c/busses/i2c-wmt.c
@@ -286,6 +286,38 @@ static irqreturn_t wmt_i2c_isr(int irq, void *data)
  	return IRQ_HANDLED;
  }
+static int wmt_i2c_init(struct platform_device *pdev, struct wmt_i2c_dev **pi2c_dev)
looks good, I would rather make this a

    static struct wmt_i2c_dev *wmt_i2c_init(struct platform_device *pdev)
    {
	struct wmt_i2c_dev *i2c_dev;
    	...
	return i2c_dev;
    }

kind of function and call it as:

    i2c_dev = wmt_i2c_init(...);
    if (IS_ERR(i2c_dev))
    	return ERR_PTR(i2c_dev);

Not a binding comment. It just looks nicer; in that case I would
call the function wmt_i2c_dev_alloc().


OK, will change it.


In any case:

Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx>

Andi





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux