Re: [RFC v2 5/6] max9260: add driver for i2c over GMSL passthrough

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

 



Hi Ulrich,

On Wednesday 16 Aug 2017 15:23:27 Ulrich Hecht wrote:
> On Mon, Jul 31, 2017 at 1:13 PM, Laurent Pinchart wrote:
> >> +static int max9260_probe(struct serdev_device *serdev)
> >> +{
> >> +     struct max9260_device *dev;
> >> +     struct i2c_adapter *adap;
> >> +     int ret;
> >> +
> >> +     dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> >> +     if (!dev)
> >> +             return -ENOMEM;
> >> +
> >> +     init_waitqueue_head(&dev->rx_wq);
> >> +
> >> +     dev->serdev = serdev;
> >> +     serdev_device_open(serdev);
> >> +     serdev_device_set_drvdata(serdev, dev);
> >> +
> >> +     serdev_device_set_client_ops(serdev, &max9260_serdev_client_ops);
> >> +
> >> +     ret = max9260_setup(dev);
> >> +     if (ret < 0)
> >> +             goto err_free;
> >> +
> >> +     adap = &dev->adap;
> >> +     i2c_set_adapdata(adap, dev);
> >> +
> >> +     adap->owner = THIS_MODULE;
> >> +     adap->algo = &max9260_i2c_algorithm;
> >> +     adap->dev.parent = &serdev->dev;
> >> +     adap->retries = 5;
> >> +     strlcpy(adap->name, dev_name(&serdev->dev), sizeof(adap->name));
> >> +
> >> +     ret = i2c_add_adapter(adap);
> >> +     if (ret < 0)
> >> +             return ret;
> >> +
> >> +     return 0;
> >> +
> >> +err_free:
> > No need for a serdev_device_close() ?
> 
> serdev_device_{open,close}() actually operate on the controller, so
> that would pull the rug from under the other devices connected to that
> controller.

My point is that you call open in the .probe() handler and close in the 
.remove() handler. If open needs to be balanced by close, it seems to me that 
you should also call close in the error path.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux