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]

 



On Mon, Jul 31, 2017 at 1:13 PM, Laurent Pinchart
<laurent.pinchart@xxxxxxxxxxxxxxxx> 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.

CU
Uli



[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