Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* ------------------------------------------------------------------------ */
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#define DEFAULT_BASE 0x378
-static int base;
-MODULE_PARM(base, "i");
+static u16 base;
+module_param(base, ushort, 0);
MODULE_PARM_DESC(base, "Base I/O address");
/* ----- Low-level parallel port access ----------------------------------- */
.getsda = parport_getsda,
.getscl = parport_getscl,
.udelay = 50,
- .mdelay = 50,
.timeout = HZ,
};
static struct i2c_adapter parport_adapter = {
.owner = THIS_MODULE,
- .class = I2C_ADAP_CLASS_SMBUS,
+ .class = I2C_CLASS_HWMON,
.id = I2C_HW_B_LP,
.algo_data = &parport_algo_data,
.name = "Parallel port adapter (light)",
static int __init i2c_parport_init(void)
{
- int type_count;
+ if (type < 0) {
+ printk(KERN_WARNING "i2c-parport: adapter type unspecified\n");
+ return -ENODEV;
+ }
- type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
- if (type < 0 || type >= type_count) {
+ if (type >= ARRAY_SIZE(adapter_parm)) {
printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
- type = 0;
+ return -ENODEV;
}
-
+
if (base == 0) {
printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);
base = DEFAULT_BASE;
release_region(base, 3);
return -ENODEV;
}
-
+
return 0;
}
if (adapter_parm[type].init.val)
line_set(0, &adapter_parm[type].init);
- i2c_bit_del_bus(&parport_adapter);
+ i2c_del_adapter(&parport_adapter);
release_region(base, 3);
}