Re: [PATCH v9 1/4] mfd: add support for Diolan DLN-2 devices

From
Joe Perches <joe@perches.com>
Date
2014-10-27 16:57:56
Also in
linux-gpio, lkml
Reply to
Octavian Purdila, 2014-10-27
On Mon, 2014-10-27 at 18:31 +0200, Octavian Purdila wrote:
This patch implements the USB part of the Diolan USB-I2C/SPI/GPIO
Master Adapter DLN-2. Details about the device can be found here:
trivia:
quoted hunk ↗ jump to hunk
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
[]
quoted hunk ↗ jump to hunk
+static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
+			  const void *obuf, unsigned obuf_len,
+			  void *ibuf, unsigned *ibuf_len)
+{
+	int ret = 0;
+	int rx_slot;
+	struct dln2_response *rsp;
+	struct dln2_rx_context *rxc;
+	struct device *dev = &dln2->interface->dev;
+	const int timeout = DLN2_USB_TIMEOUT * HZ / 1000;
unsigned long timeout?

[]
quoted hunk ↗ jump to hunk
+	ret = wait_for_completion_interruptible_timeout(&rxc->done, timeout);
+	if (ret <= 0) {
+		if (!ret)
+			ret = -ETIMEDOUT;
+		goto out_free_rx_slot;
+	}
[]
quoted hunk ↗ jump to hunk
+static int dln2_print_serialno(struct dln2_dev *dln2)
+{
+	int ret;
+	__le32 serial_no;
+	int len = sizeof(serial_no);
+	struct device *dev = &dln2->interface->dev;
+
+	ret = _dln2_transfer(dln2, DLN2_HANDLE_CTRL, CMD_GET_DEVICE_SN, NULL, 0,
+			     &serial_no, &len);
+	if (ret < 0)
+		return ret;
+	if (len < sizeof(serial_no))
+		return -EREMOTEIO;
+
+	dev_info(dev, "Diolan DLN2 serial 0x%x\n", le32_to_cpu(serial_no));
why a hex serial #?

Thread (10 messages) 10 messages, 3 authors, last reply 2014-11-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help