dio.c (c58310bf4933986513020fa90b4190c7492995ae) | dio.c (2e4c77bea3d8b17d94f8ee382411f359b708560f) |
---|---|
1/* Code to support devices on the DIO and DIO-II bus 2 * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk> 3 * Copyright (C) 2004 Jochen Friedrich <jochen@scram.de> 4 * 5 * This code has basically these routines at the moment: 6 * int dio_find(u_int deviceid) 7 * Search the list of DIO devices and return the select code 8 * of the next unconfigured device found that matches the given device ID. --- 159 unchanged lines hidden (view full) --- 168 * hardware is actually present. 169 */ 170static int __init dio_init(void) 171{ 172 int scode; 173 mm_segment_t fs; 174 int i; 175 struct dio_dev *dev; | 1/* Code to support devices on the DIO and DIO-II bus 2 * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk> 3 * Copyright (C) 2004 Jochen Friedrich <jochen@scram.de> 4 * 5 * This code has basically these routines at the moment: 6 * int dio_find(u_int deviceid) 7 * Search the list of DIO devices and return the select code 8 * of the next unconfigured device found that matches the given device ID. --- 159 unchanged lines hidden (view full) --- 168 * hardware is actually present. 169 */ 170static int __init dio_init(void) 171{ 172 int scode; 173 mm_segment_t fs; 174 int i; 175 struct dio_dev *dev; |
176 int error; |
|
176 177 if (!MACH_IS_HP300) 178 return 0; 179 180 printk(KERN_INFO "Scanning for DIO devices...\n"); 181 182 /* Initialize the DIO bus */ 183 INIT_LIST_HEAD(&dio_bus.devices); 184 strcpy(dio_bus.dev.bus_id, "dio"); | 177 178 if (!MACH_IS_HP300) 179 return 0; 180 181 printk(KERN_INFO "Scanning for DIO devices...\n"); 182 183 /* Initialize the DIO bus */ 184 INIT_LIST_HEAD(&dio_bus.devices); 185 strcpy(dio_bus.dev.bus_id, "dio"); |
185 device_register(&dio_bus.dev); | 186 error = device_register(&dio_bus.dev); 187 if (error) { 188 pr_err("DIO: Error registering dio_bus\n"); 189 return error; 190 } |
186 187 /* Request all resources */ 188 dio_bus.num_resources = (hp300_model == HP_320 ? 1 : 2); 189 for (i = 0; i < dio_bus.num_resources; i++) 190 request_resource(&iomem_resource, &dio_bus.resources[i]); 191 192 /* Register all devices */ 193 for (scode = 0; scode < DIO_SCMAX; ++scode) --- 53 unchanged lines hidden (view full) --- 247 strcpy(dev->name,dio_getname(dev->id)); 248 printk(KERN_INFO "select code %3d: ipl %d: ID %02X", dev->scode, dev->ipl, prid); 249 if (DIO_NEEDSSECID(prid)) 250 printk(":%02X", secid); 251 printk(": %s\n", dev->name); 252 253 if (scode >= DIOII_SCBASE) 254 iounmap(va); | 191 192 /* Request all resources */ 193 dio_bus.num_resources = (hp300_model == HP_320 ? 1 : 2); 194 for (i = 0; i < dio_bus.num_resources; i++) 195 request_resource(&iomem_resource, &dio_bus.resources[i]); 196 197 /* Register all devices */ 198 for (scode = 0; scode < DIO_SCMAX; ++scode) --- 53 unchanged lines hidden (view full) --- 252 strcpy(dev->name,dio_getname(dev->id)); 253 printk(KERN_INFO "select code %3d: ipl %d: ID %02X", dev->scode, dev->ipl, prid); 254 if (DIO_NEEDSSECID(prid)) 255 printk(":%02X", secid); 256 printk(": %s\n", dev->name); 257 258 if (scode >= DIOII_SCBASE) 259 iounmap(va); |
255 device_register(&dev->dev); 256 dio_create_sysfs_dev_files(dev); | 260 error = device_register(&dev->dev); 261 if (error) { 262 pr_err("DIO: Error registering device %s\n", 263 dev->name); 264 continue; 265 } 266 error = dio_create_sysfs_dev_files(dev); 267 if (error) 268 dev_err(&dev->dev, "Error creating sysfs files\n"); |
257 } 258 return 0; 259} 260 261subsys_initcall(dio_init); 262 263/* Bear in mind that this is called in the very early stages of initialisation 264 * in order to get the address of the serial port for the console... --- 12 unchanged lines hidden --- | 269 } 270 return 0; 271} 272 273subsys_initcall(dio_init); 274 275/* Bear in mind that this is called in the very early stages of initialisation 276 * in order to get the address of the serial port for the console... --- 12 unchanged lines hidden --- |