Thread (26 messages) 26 messages, 6 authors, 2017-08-16

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

From: Ulrich Hecht <hidden>
Date: 2017-08-16 13:23:29
Also in: linux-i2c, linux-renesas-soc

On Mon, Jul 31, 2017 at 1:13 PM, Laurent Pinchart
[off-list ref] wrote:
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help