Loading drivers/i2c/busses/scx200_acb.c +43 −47 Original line number Diff line number Diff line /* linux/drivers/i2c/scx200_acb.c /* Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> National Semiconductor SCx200 ACCESS.bus support Loading @@ -21,7 +20,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/module.h> Loading Loading @@ -79,8 +77,7 @@ static const char *scx200_acb_state_name[] = { }; /* Physical interface */ struct scx200_acb_iface { struct scx200_acb_iface { struct scx200_acb_iface *next; struct i2c_adapter adapter; unsigned base; Loading Loading @@ -298,6 +295,7 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter, len = 0; buffer = NULL; break; case I2C_SMBUS_BYTE: if (rw == I2C_SMBUS_READ) { len = 1; Loading @@ -307,19 +305,23 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter, buffer = &command; } break; case I2C_SMBUS_BYTE_DATA: len = 1; buffer = &data->byte; break; case I2C_SMBUS_WORD_DATA: len = 2; cur_word = cpu_to_le16(data->word); buffer = (u8 *)&cur_word; break; case I2C_SMBUS_BLOCK_DATA: len = data->block[0]; buffer = &data->block[1]; break; default: return -EINVAL; } Loading Loading @@ -459,7 +461,8 @@ static int __init scx200_acb_create(int base, int index) init_MUTEX(&iface->sem); snprintf(description, sizeof(description), "NatSemi SCx200 ACCESS.bus [%s]", adapter->name); snprintf(description, sizeof(description), "NatSemi SCx200 ACCESS.bus [%s]", adapter->name); if (request_region(base, 8, description) == 0) { dev_err(&adapter->dev, "can't allocate io 0x%x-0x%x\n", base, base + 8-1); Loading Loading @@ -528,6 +531,7 @@ static int __init scx200_acb_init(void) static void __exit scx200_acb_cleanup(void) { struct scx200_acb_iface *iface; lock_kernel(); while ((iface = scx200_acb_list) != NULL) { scx200_acb_list = iface->next; Loading @@ -543,11 +547,3 @@ static void __exit scx200_acb_cleanup(void) module_init(scx200_acb_init); module_exit(scx200_acb_cleanup); /* Local variables: compile-command: "make -k -C ../.. SUBDIRS=drivers/i2c modules" c-basic-offset: 8 End: */ Loading
drivers/i2c/busses/scx200_acb.c +43 −47 Original line number Diff line number Diff line /* linux/drivers/i2c/scx200_acb.c /* Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> National Semiconductor SCx200 ACCESS.bus support Loading @@ -21,7 +20,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/module.h> Loading Loading @@ -79,8 +77,7 @@ static const char *scx200_acb_state_name[] = { }; /* Physical interface */ struct scx200_acb_iface { struct scx200_acb_iface { struct scx200_acb_iface *next; struct i2c_adapter adapter; unsigned base; Loading Loading @@ -298,6 +295,7 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter, len = 0; buffer = NULL; break; case I2C_SMBUS_BYTE: if (rw == I2C_SMBUS_READ) { len = 1; Loading @@ -307,19 +305,23 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter, buffer = &command; } break; case I2C_SMBUS_BYTE_DATA: len = 1; buffer = &data->byte; break; case I2C_SMBUS_WORD_DATA: len = 2; cur_word = cpu_to_le16(data->word); buffer = (u8 *)&cur_word; break; case I2C_SMBUS_BLOCK_DATA: len = data->block[0]; buffer = &data->block[1]; break; default: return -EINVAL; } Loading Loading @@ -459,7 +461,8 @@ static int __init scx200_acb_create(int base, int index) init_MUTEX(&iface->sem); snprintf(description, sizeof(description), "NatSemi SCx200 ACCESS.bus [%s]", adapter->name); snprintf(description, sizeof(description), "NatSemi SCx200 ACCESS.bus [%s]", adapter->name); if (request_region(base, 8, description) == 0) { dev_err(&adapter->dev, "can't allocate io 0x%x-0x%x\n", base, base + 8-1); Loading Loading @@ -528,6 +531,7 @@ static int __init scx200_acb_init(void) static void __exit scx200_acb_cleanup(void) { struct scx200_acb_iface *iface; lock_kernel(); while ((iface = scx200_acb_list) != NULL) { scx200_acb_list = iface->next; Loading @@ -543,11 +547,3 @@ static void __exit scx200_acb_cleanup(void) module_init(scx200_acb_init); module_exit(scx200_acb_cleanup); /* Local variables: compile-command: "make -k -C ../.. SUBDIRS=drivers/i2c modules" c-basic-offset: 8 End: */