Re: [PATCH] i2c: drivers: Avoid unnecessary check inefm32_i2c_probe()

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

 



Hi Uwe:

On 2020/4/16 14:50, Uwe Kleine-König wrote:
diff --git a/drivers/i2c/busses/i2c-efm32.c b/drivers/i2c/busses/i2c-efm32.c
index 4de31fae7..4786ef6b2 100644
--- a/drivers/i2c/busses/i2c-efm32.c
+++ b/drivers/i2c/busses/i2c-efm32.c
@@ -312,9 +312,6 @@ static int efm32_i2c_probe(struct platform_device *pdev)
   	int ret;
   	u32 clkdiv;
-	if (!np)
-		return -EINVAL;
-
I don't care much about this change. While the statement that this
driver is only instantiated on dt platforms is probably right,
explicitly checking for it might still prevent surprises later, serves
as explicit statement for the driver reader that non-dt isn't supposed
to work and given that the check is cheap I tend slightly to just keep
it.

In this driver, the function efm32_i2c_probe() can be triggered only if the
platform_device and platform_driver matches,  and the matching condition is
DTS. It's my opinion.
I admit I didn't recheck, but I think the driver will also be matched on
non-dt platforms that provide an "efm32-i2c" device.

Year, I agree with you, the driver should be matched on dt or non-dt platforms. But for non-dt platforms, I think this driver may need minor changes, after all, it is just suitable for the dt platforms right now. That's my shallow opinions.

Thanks for your patient guidance and reply, thank you. I think you are also a good teacher, thanks.

Tang Bin








[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