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

2014-09-18 Thread Johan Hovold
On Tue, Sep 09, 2014 at 10:24:44PM +0300, Octavian Purdila wrote:

 +static int alloc_rx_slot(struct dln2_mod_rx_slots *rxs)
 +{
 + int ret;
 + int slot;
 +
 + /* No need to timeout here, the wait is bounded by the timeout
 +  * in _dln2_transfer
 +  */
 + ret = wait_event_interruptible(rxs-wq, find_free_slot(rxs, slot));
 + if (ret  0)
 + return ret;
 +
 + return slot;
 +}
 +
 +static void free_rx_slot(struct dln2_dev *dln2, struct dln2_mod_rx_slots 
 *rxs,
 +  int slot)
 +{
 + struct urb *urb = NULL;
 + unsigned long flags;
 + struct dln2_rx_context *rxc;
 + struct device *dev = dln2-interface-dev;
 + int ret;
 +
 + spin_lock_irqsave(rxs-lock, flags);
 +
 + clear_bit(slot, rxs-bmap);
 +
 + rxc = rxs-slots[slot];
 + rxc-connected = false;
 + urb = rxc-urb;
 + rxc-urb = NULL;
 + reinit_completion(rxc-done);
 +
 + spin_unlock_irqrestore(rxs-lock, flags);
 +
 + if (urb)  {
 + ret = usb_submit_urb(urb, GFP_KERNEL);
 + if (ret  0)
 + dev_err(dev, failed to re-submit RX URB: %d\n, ret);
 + }
 +
 + wake_up_interruptible(rxs-wq);
 +}

 +static void dln2_rx_transfer(struct dln2_dev *dln2, struct urb *urb,
 +  u16 handle, u16 rx_slot)
 +{
 + struct dln2_mod_rx_slots *rxs = dln2-mod_rx_slots[handle];
 + struct dln2_rx_context *rxc;
 + struct device *dev = dln2-interface-dev;
 + int err;
 +
 + spin_lock(rxs-lock);
 + rxc = rxs-slots[rx_slot];
 + if (rxc-connected) {
 + rxc-urb = urb;
 + complete(rxc-done);
 + } else {
 + dev_warn(dev, dropping response %d/%d, handle, rx_slot);
 + err = usb_submit_urb(urb, GFP_ATOMIC);
 + if (err  0)
 + dev_err(dev, failed to re-submit RX URB: %d\n, err);
 + }
 + spin_unlock(rxs-lock);
 +}

 +static void dln2_rx(struct urb *urb)
 +{
 + int err;
 + struct dln2_dev *dln2 = urb-context;
 + struct dln2_header *hdr = urb-transfer_buffer;
 + struct device *dev = dln2-interface-dev;
 + u16 id, echo, handle, size;
 + u8 *data;
 + int len;
 +
 + switch (urb-status) {
 + case 0:
 + /* success */
 + break;
 + case -ECONNRESET:
 + case -ENOENT:
 + case -ESHUTDOWN:
 + case -EPIPE:
 + /* this urb is terminated, clean up */
 + dev_dbg(dev, urb shutting down with status %d\n, urb-status);
 + return;
 + default:
 + dev_dbg(dev, nonzero urb status received %d\n, urb-status);
 + goto out;
 + }
 +
 + if (urb-actual_length  sizeof(struct dln2_header)) {
 + dev_err(dev, short response: %d\n, urb-actual_length);
 + goto out;
 + }
 +
 + handle = le16_to_cpu(hdr-handle);
 + id = le16_to_cpu(hdr-id);
 + echo = le16_to_cpu(hdr-echo);
 + size = le16_to_cpu(hdr-size);
 +
 + if (size != urb-actual_length) {
 + dev_err(dev, size mismatch: handle %x cmd %x echo %x size %d 
 actual %d\n,
 + handle, id, echo, size, urb-actual_length);
 + goto out;
 + }
 +
 + if (handle = DLN2_MAX_MODULES) {
 + dev_warn(dev, RX: invalid handle %d\n, handle);
 + goto out;
 + }
 +
 + data = urb-transfer_buffer + sizeof(struct dln2_header);
 + len = urb-actual_length - sizeof(struct dln2_header);
 +
 + if (handle == DLN2_HANDLE_EVENT) {
 + dln2_run_rx_callbacks(dln2, id, echo, data, len);
 + err = usb_submit_urb(urb, GFP_ATOMIC);
 + if (err  0)
 + goto out_submit_failed;
 + } else {
 + dln2_rx_transfer(dln2, urb, handle, echo);
 + }
 +
 + return;
 +
 +out:
 + err = usb_submit_urb(urb, GFP_ATOMIC);
 +out_submit_failed:
 + if (err  0)
 + dev_err(dev, failed to re-submit RX URB: %d\n, err);
 +}

 +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;
 + u16 result;
 + 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;
 + struct dln2_mod_rx_slots *rxs = dln2-mod_rx_slots[handle];
 +
 + rx_slot = alloc_rx_slot(rxs);
 + if (rx_slot  0)
 + return rx_slot;
 +
 + ret = dln2_send_wait(dln2, handle, cmd, rx_slot, obuf, obuf_len);
 + if (ret  0) {
 + free_rx_slot(dln2, rxs, rx_slot);
 + dev_err(dev, USB write failed: %d, ret);
 + return ret;
 + }
 +
 + rxc = rxs-slots[rx_slot];
 +
 + ret = wait_for_completion_interruptible_timeout(rxc-done, timeout);
 + if (ret = 0) {
 + 

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

2014-09-18 Thread Johan Hovold
On Tue, Sep 09, 2014 at 10:24:44PM +0300, Octavian Purdila wrote:

 +MODULE_AUTHOR(Octavian Purdila octavian.purd...@intel.com);
 +MODULE_DESCRIPTION(DRIVER_NAME  driver);
 +MODULE_LICENSE(GPL);

Just noticed both the i2c and gpio driver is lacking a MODULE_ALIAS to
enable module auto-loading.

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


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

2014-09-17 Thread Octavian Purdila
On Wed, Sep 17, 2014 at 2:21 AM, Lee Jones lee.jo...@linaro.org wrote:

 On Tue, 09 Sep 2014, 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:
 
  https://www.diolan.com/i2c/i2c_interface.html.
 
  Information about the USB protocol can be found in the Programmer's
  Reference Manual [1], see section 1.7.

 This driver really needs a USB Ack before I can accept it.


Greg, Johan, is the driver acceptable now?

  Because the hardware has a single transmit endpoint and a single
  receive endpoint the communication between the various DLN2 drivers
  and the hardware will be muxed/demuxed by this driver.
 
  Each DLN2 module will be identified by the handle field within the DLN2
  message header. If a DLN2 module issues multiple commands in parallel
  they will be identified by the echo counter field in the message header.
 
  The DLN2 modules can use the dln2_transfer() function to issue a
  command and wait for its response. They can also register a callback
  that is going to be called when a specific event id is generated by
  the device (e.g. GPIO interrupts). The device uses handle 0 for
  sending events.
 
  [1] https://www.diolan.com/downloads/dln-api-manual.pdf
 
  Signed-off-by: Octavian Purdila octavian.purd...@intel.com
  ---
   drivers/mfd/Kconfig  |   9 +
   drivers/mfd/Makefile |   1 +
   drivers/mfd/dln2.c   | 681 
  +++
   include/linux/mfd/dln2.h |  71 +
   4 files changed, 762 insertions(+)
   create mode 100644 drivers/mfd/dln2.c
   create mode 100644 include/linux/mfd/dln2.h

 [...]

  diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
  new file mode 100644
  index 000..b551b5e
  --- /dev/null
  +++ b/drivers/mfd/dln2.c
  @@ -0,0 +1,681 @@
  +/*
  + * Driver for the Diolan DLN-2 USB adapter
  + *
  + * Copyright (c) 2014 Intel Corporation
  + *
  + * Derived from:
  + *  i2c-diolan-u2c.c
  + *  Copyright (c) 2010-2011 Ericsson AB
  + *
  + * This program is free software; you can redistribute it and/or
  + * modify it under the terms of the GNU General Public License as
  + * published by the Free Software Foundation, version 2.
  + */
  +
  +#include linux/kernel.h
  +#include linux/errno.h

 What are you using this for?


Not needed, I will remove it.

  +#include linux/module.h
  +#include linux/types.h
  +#include linux/slab.h
  +#include linux/usb.h
  +#include linux/i2c.h
  +#include linux/mutex.h
  +#include linux/platform_device.h
  +#include linux/mfd/core.h
  +#include linux/mfd/dln2.h
  +
  +#define DRIVER_NAME  usb-dln2

 Don't do this, just use usb-dln2 where it needs to be used.


Will do.

 [...]

  +static struct usb_driver dln2_driver = {
  + .name = DRIVER_NAME,
  + .probe = dln2_probe,
  + .disconnect = dln2_disconnect,
  + .id_table = dln2_table,
  +};
  +
  +module_usb_driver(dln2_driver);
  +
  +MODULE_AUTHOR(Octavian Purdila octavian.purd...@intel.com);
  +MODULE_DESCRIPTION(DRIVER_NAME  driver);

 This is not a description.

  +MODULE_LICENSE(GPL);

 Header says v2.


I will change it to GPL v2.

  diff --git a/include/linux/mfd/dln2.h b/include/linux/mfd/dln2.h
  new file mode 100644
  index 000..197565d
  --- /dev/null
  +++ b/include/linux/mfd/dln2.h
  @@ -0,0 +1,71 @@
  +#ifndef __LINUX_USB_DLN2_H
  +#define __LINUX_USB_DLN2_H
  +
  +#define DLN2_CMD(cmd, id)((cmd) | ((id)  8))
  +
  +struct dln2_platform_data {
  + u16 handle;
  + union {
  + struct {
  + u8 port;
  + } i2c;
  + };
  +};

 Why this complexity?


There is also an SPI interface on this adapter which will probably the
port information and maybe some additional information. Would you
prefer to add the union later, when we add the SPI driver?
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-09-17 Thread Johan Hovold
On Wed, Sep 17, 2014 at 10:25:18AM +0300, Octavian Purdila wrote:
 On Wed, Sep 17, 2014 at 2:21 AM, Lee Jones lee.jo...@linaro.org wrote:
 
  On Tue, 09 Sep 2014, 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:
  
   https://www.diolan.com/i2c/i2c_interface.html.
  
   Information about the USB protocol can be found in the Programmer's
   Reference Manual [1], see section 1.7.
 
  This driver really needs a USB Ack before I can accept it.
 
 
 Greg, Johan, is the driver acceptable now?

I started looking through v4 yesterday and found a few more things. Will
send you some you comments shortly.

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


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

2014-09-17 Thread Johan Hovold
On Tue, Sep 09, 2014 at 10:24:44PM +0300, 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:
 
 https://www.diolan.com/i2c/i2c_interface.html.
 
 Information about the USB protocol can be found in the Programmer's
 Reference Manual [1], see section 1.7.
 
 Because the hardware has a single transmit endpoint and a single
 receive endpoint the communication between the various DLN2 drivers
 and the hardware will be muxed/demuxed by this driver.
 
 Each DLN2 module will be identified by the handle field within the DLN2
 message header. If a DLN2 module issues multiple commands in parallel
 they will be identified by the echo counter field in the message header.
 
 The DLN2 modules can use the dln2_transfer() function to issue a
 command and wait for its response. They can also register a callback
 that is going to be called when a specific event id is generated by
 the device (e.g. GPIO interrupts). The device uses handle 0 for
 sending events.
 
 [1] https://www.diolan.com/downloads/dln-api-manual.pdf
 
 Signed-off-by: Octavian Purdila octavian.purd...@intel.com
 ---
  drivers/mfd/Kconfig  |   9 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/dln2.c   | 681 
 +++
  include/linux/mfd/dln2.h |  71 +
  4 files changed, 762 insertions(+)
  create mode 100644 drivers/mfd/dln2.c
  create mode 100644 include/linux/mfd/dln2.h
 
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index de5abf2..7bcf895 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -183,6 +183,15 @@ config MFD_DA9063
 Additional drivers must be enabled in order to use the functionality
 of the device.
  
 +config MFD_DLN2
 + tristate Diolan DLN2 support
 + select MFD_CORE
 + depends on USB
 + help
 +   This adds support for Diolan USB-I2C/SPI/GPIO Master Adapter DLN-2.
 +   Additional drivers must be enabled in order to use the functionality
 +   of the device.
 +
  config MFD_MC13XXX
   tristate
   depends on (SPI_MASTER || I2C)
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index f001487..591988d 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -169,6 +169,7 @@ obj-$(CONFIG_MFD_AS3711)  += as3711.o
  obj-$(CONFIG_MFD_AS3722) += as3722.o
  obj-$(CONFIG_MFD_STW481X)+= stw481x.o
  obj-$(CONFIG_MFD_IPAQ_MICRO) += ipaq-micro.o
 +obj-$(CONFIG_MFD_DLN2)   += dln2.o
  
  intel-soc-pmic-objs  := intel_soc_pmic_core.o intel_soc_pmic_crc.o
  obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
 diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
 new file mode 100644
 index 000..b551b5e
 --- /dev/null
 +++ b/drivers/mfd/dln2.c
 @@ -0,0 +1,681 @@
 +/*
 + * Driver for the Diolan DLN-2 USB adapter
 + *
 + * Copyright (c) 2014 Intel Corporation
 + *
 + * Derived from:
 + *  i2c-diolan-u2c.c
 + *  Copyright (c) 2010-2011 Ericsson AB
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation, version 2.
 + */
 +
 +#include linux/kernel.h
 +#include linux/errno.h
 +#include linux/module.h
 +#include linux/types.h
 +#include linux/slab.h
 +#include linux/usb.h
 +#include linux/i2c.h
 +#include linux/mutex.h
 +#include linux/platform_device.h
 +#include linux/mfd/core.h
 +#include linux/mfd/dln2.h
 +
 +#define DRIVER_NAME  usb-dln2
 +
 +struct dln2_header {
 + __le16 size;
 + __le16 id;
 + __le16 echo;
 + __le16 handle;
 +} __packed;
 +
 +struct dln2_response {
 + struct dln2_header hdr;
 + __le16 result;
 +} __packed;
 +
 +#define DLN2_GENERIC_MODULE_ID   0x00
 +#define DLN2_GENERIC_CMD(cmd)DLN2_CMD(cmd, 
 DLN2_GENERIC_MODULE_ID)
 +#define CMD_GET_DEVICE_VER   DLN2_GENERIC_CMD(0x30)
 +#define CMD_GET_DEVICE_SNDLN2_GENERIC_CMD(0x31)
 +
 +#define DLN2_HW_ID   0x200
 +#define DLN2_USB_TIMEOUT 200 /* in ms */
 +#define DLN2_MAX_RX_SLOTS16
 +#define DLN2_MAX_MODULES 5

Reduce to 4 until you implement support for more modules and save some
memory meanwhile? (Or is id 4 already used?)

 +#define DLN2_MAX_URBS16
 +#define DLN2_RX_BUF_SIZE 512
 +
 +#define DLN2_HANDLE_EVENT0
 +#define DLN2_HANDLE_CTRL 1
 +#define DLN2_HANDLE_GPIO 2
 +#define DLN2_HANDLE_I2C  3
 +
 +/*
 + * Receive context used between the receive demultiplexer and the
 + * transfer routine. While sending a request the transfer routine
 + * will look for a free receive context and use it to wait for a
 + * response and to receive the URB and thus the response data.
 + */
 +struct dln2_rx_context {
 + struct completion done;
 + struct urb *urb;
 + 

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

2014-09-17 Thread Lee Jones
On Wed, 17 Sep 2014, Johan Hovold wrote:
 On Tue, Sep 09, 2014 at 10:24:44PM +0300, 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:
  
  https://www.diolan.com/i2c/i2c_interface.html.
  
  Information about the USB protocol can be found in the Programmer's
  Reference Manual [1], see section 1.7.
  
  Because the hardware has a single transmit endpoint and a single
  receive endpoint the communication between the various DLN2 drivers
  and the hardware will be muxed/demuxed by this driver.
  
  Each DLN2 module will be identified by the handle field within the DLN2
  message header. If a DLN2 module issues multiple commands in parallel
  they will be identified by the echo counter field in the message header.
  
  The DLN2 modules can use the dln2_transfer() function to issue a
  command and wait for its response. They can also register a callback
  that is going to be called when a specific event id is generated by
  the device (e.g. GPIO interrupts). The device uses handle 0 for
  sending events.
  
  [1] https://www.diolan.com/downloads/dln-api-manual.pdf
  
  Signed-off-by: Octavian Purdila octavian.purd...@intel.com
  ---
   drivers/mfd/Kconfig  |   9 +
   drivers/mfd/Makefile |   1 +
   drivers/mfd/dln2.c   | 681 
  +++
   include/linux/mfd/dln2.h |  71 +
   4 files changed, 762 insertions(+)
   create mode 100644 drivers/mfd/dln2.c
   create mode 100644 include/linux/mfd/dln2.h

[...]

 Unless anyone suggests otherwise (e.g. to stick with auto id), I'll add
 a helper function for this and fix up those two drivers.

Appreciated.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-09-17 Thread Lee Jones
On Wed, 17 Sep 2014, Octavian Purdila wrote:
 On Wed, Sep 17, 2014 at 2:21 AM, Lee Jones lee.jo...@linaro.org wrote:
 
  On Tue, 09 Sep 2014, 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:
  
   https://www.diolan.com/i2c/i2c_interface.html.
  
   Information about the USB protocol can be found in the Programmer's
   Reference Manual [1], see section 1.7.
  
   Because the hardware has a single transmit endpoint and a single
   receive endpoint the communication between the various DLN2 drivers
   and the hardware will be muxed/demuxed by this driver.
  
   Each DLN2 module will be identified by the handle field within the DLN2
   message header. If a DLN2 module issues multiple commands in parallel
   they will be identified by the echo counter field in the message header.
  
   The DLN2 modules can use the dln2_transfer() function to issue a
   command and wait for its response. They can also register a callback
   that is going to be called when a specific event id is generated by
   the device (e.g. GPIO interrupts). The device uses handle 0 for
   sending events.
  
   [1] https://www.diolan.com/downloads/dln-api-manual.pdf
  
   Signed-off-by: Octavian Purdila octavian.purd...@intel.com
   ---
drivers/mfd/Kconfig  |   9 +
drivers/mfd/Makefile |   1 +
drivers/mfd/dln2.c   | 681 
   +++
include/linux/mfd/dln2.h |  71 +
4 files changed, 762 insertions(+)
create mode 100644 drivers/mfd/dln2.c
create mode 100644 include/linux/mfd/dln2.h

[...]

   diff --git a/include/linux/mfd/dln2.h b/include/linux/mfd/dln2.h
   new file mode 100644
   index 000..197565d
   --- /dev/null
   +++ b/include/linux/mfd/dln2.h
   @@ -0,0 +1,71 @@
   +#ifndef __LINUX_USB_DLN2_H
   +#define __LINUX_USB_DLN2_H
   +
   +#define DLN2_CMD(cmd, id)((cmd) | ((id)  8))
   +
   +struct dln2_platform_data {
   + u16 handle;
   + union {
   + struct {
   + u8 port;
   + } i2c;
   + };
   +};
 
  Why this complexity?
 
 There is also an SPI interface on this adapter which will probably the
 port information and maybe some additional information. Would you
 prefer to add the union later, when we add the SPI driver?

Yes please.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-09-16 Thread Lee Jones
On Tue, 09 Sep 2014, 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:
 
 https://www.diolan.com/i2c/i2c_interface.html.
 
 Information about the USB protocol can be found in the Programmer's
 Reference Manual [1], see section 1.7.

This driver really needs a USB Ack before I can accept it.

 Because the hardware has a single transmit endpoint and a single
 receive endpoint the communication between the various DLN2 drivers
 and the hardware will be muxed/demuxed by this driver.
 
 Each DLN2 module will be identified by the handle field within the DLN2
 message header. If a DLN2 module issues multiple commands in parallel
 they will be identified by the echo counter field in the message header.
 
 The DLN2 modules can use the dln2_transfer() function to issue a
 command and wait for its response. They can also register a callback
 that is going to be called when a specific event id is generated by
 the device (e.g. GPIO interrupts). The device uses handle 0 for
 sending events.
 
 [1] https://www.diolan.com/downloads/dln-api-manual.pdf
 
 Signed-off-by: Octavian Purdila octavian.purd...@intel.com
 ---
  drivers/mfd/Kconfig  |   9 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/dln2.c   | 681 
 +++
  include/linux/mfd/dln2.h |  71 +
  4 files changed, 762 insertions(+)
  create mode 100644 drivers/mfd/dln2.c
  create mode 100644 include/linux/mfd/dln2.h

[...]

 diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
 new file mode 100644
 index 000..b551b5e
 --- /dev/null
 +++ b/drivers/mfd/dln2.c
 @@ -0,0 +1,681 @@
 +/*
 + * Driver for the Diolan DLN-2 USB adapter
 + *
 + * Copyright (c) 2014 Intel Corporation
 + *
 + * Derived from:
 + *  i2c-diolan-u2c.c
 + *  Copyright (c) 2010-2011 Ericsson AB
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation, version 2.
 + */
 +
 +#include linux/kernel.h
 +#include linux/errno.h

What are you using this for?

 +#include linux/module.h
 +#include linux/types.h
 +#include linux/slab.h
 +#include linux/usb.h
 +#include linux/i2c.h
 +#include linux/mutex.h
 +#include linux/platform_device.h
 +#include linux/mfd/core.h
 +#include linux/mfd/dln2.h
 +
 +#define DRIVER_NAME  usb-dln2

Don't do this, just use usb-dln2 where it needs to be used.

[...]

 +static struct usb_driver dln2_driver = {
 + .name = DRIVER_NAME,
 + .probe = dln2_probe,
 + .disconnect = dln2_disconnect,
 + .id_table = dln2_table,
 +};
 +
 +module_usb_driver(dln2_driver);
 +
 +MODULE_AUTHOR(Octavian Purdila octavian.purd...@intel.com);
 +MODULE_DESCRIPTION(DRIVER_NAME  driver);

This is not a description.

 +MODULE_LICENSE(GPL);

Header says v2.

 diff --git a/include/linux/mfd/dln2.h b/include/linux/mfd/dln2.h
 new file mode 100644
 index 000..197565d
 --- /dev/null
 +++ b/include/linux/mfd/dln2.h
 @@ -0,0 +1,71 @@
 +#ifndef __LINUX_USB_DLN2_H
 +#define __LINUX_USB_DLN2_H
 +
 +#define DLN2_CMD(cmd, id)((cmd) | ((id)  8))
 +
 +struct dln2_platform_data {
 + u16 handle;
 + union {
 + struct {
 + u8 port;
 + } i2c;
 + };
 +};

Why this complexity?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html