提交 e28cab42 编写于 作者: L Linus Torvalds

Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-tiny-usb: Fix on big-endian systems
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h>
/* include interfaces to usb layer */ /* include interfaces to usb layer */
#include <linux/usb.h> #include <linux/usb.h>
...@@ -31,8 +32,8 @@ ...@@ -31,8 +32,8 @@
#define CMD_I2C_IO_END (1<<1) #define CMD_I2C_IO_END (1<<1)
/* i2c bit delay, default is 10us -> 100kHz */ /* i2c bit delay, default is 10us -> 100kHz */
static int delay = 10; static unsigned short delay = 10;
module_param(delay, int, 0); module_param(delay, ushort, 0);
MODULE_PARM_DESC(delay, "bit delay in microseconds, " MODULE_PARM_DESC(delay, "bit delay in microseconds, "
"e.g. 10 for 100kHz (default is 100kHz)"); "e.g. 10 for 100kHz (default is 100kHz)");
...@@ -109,7 +110,7 @@ static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) ...@@ -109,7 +110,7 @@ static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
static u32 usb_func(struct i2c_adapter *adapter) static u32 usb_func(struct i2c_adapter *adapter)
{ {
u32 func; __le32 func;
/* get functionality from adapter */ /* get functionality from adapter */
if (usb_read(adapter, CMD_GET_FUNC, 0, 0, &func, sizeof(func)) != if (usb_read(adapter, CMD_GET_FUNC, 0, 0, &func, sizeof(func)) !=
...@@ -118,7 +119,7 @@ static u32 usb_func(struct i2c_adapter *adapter) ...@@ -118,7 +119,7 @@ static u32 usb_func(struct i2c_adapter *adapter)
return 0; return 0;
} }
return func; return le32_to_cpu(func);
} }
/* This is the actual algorithm we define */ /* This is the actual algorithm we define */
...@@ -216,8 +217,7 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface, ...@@ -216,8 +217,7 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
"i2c-tiny-usb at bus %03d device %03d", "i2c-tiny-usb at bus %03d device %03d",
dev->usb_dev->bus->busnum, dev->usb_dev->devnum); dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
if (usb_write(&dev->adapter, CMD_SET_DELAY, if (usb_write(&dev->adapter, CMD_SET_DELAY, delay, 0, NULL, 0) != 0) {
cpu_to_le16(delay), 0, NULL, 0) != 0) {
dev_err(&dev->adapter.dev, dev_err(&dev->adapter.dev,
"failure setting delay to %dus\n", delay); "failure setting delay to %dus\n", delay);
retval = -EIO; retval = -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册