Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ide: fix ->init_chipset method to return 'int' value

* Return 0 instead of dev->irq in ->init_chipset implementations.

* Fix ->init_chipset method to return 'int' value instead of
'unsigned int' one.

This fixes ->init_chipset handling for host drivers (cs5530, hpt366
and pdc202xx_new) for which it is possible for this method to fail.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

+26 -26
+2 -2
drivers/ide/aec62xx.c
··· 139 139 drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0); 140 140 } 141 141 142 - static unsigned int init_chipset_aec62xx(struct pci_dev *dev) 142 + static int init_chipset_aec62xx(struct pci_dev *dev) 143 143 { 144 144 /* These are necessary to get AEC6280 Macintosh cards to work */ 145 145 if ((dev->device == PCI_DEVICE_ID_ARTOP_ATP865) || ··· 156 156 pci_write_config_byte(dev, 0x4a, reg4ah | 0x80); 157 157 } 158 158 159 - return dev->irq; 159 + return 0; 160 160 } 161 161 162 162 static u8 atp86x_cable_detect(ide_hwif_t *hwif)
+1 -1
drivers/ide/alim15x3.c
··· 212 212 * appropriate also sets up the 1533 southbridge. 213 213 */ 214 214 215 - static unsigned int init_chipset_ali15x3(struct pci_dev *dev) 215 + static int init_chipset_ali15x3(struct pci_dev *dev) 216 216 { 217 217 unsigned long flags; 218 218 u8 tmpbyte;
+2 -2
drivers/ide/amd74xx.c
··· 140 140 * The initialization callback. Initialize drive independent registers. 141 141 */ 142 142 143 - static unsigned int init_chipset_amd74xx(struct pci_dev *dev) 143 + static int init_chipset_amd74xx(struct pci_dev *dev) 144 144 { 145 145 u8 t = 0, offset = amd_offset(dev); 146 146 ··· 172 172 t |= 0xf0; 173 173 pci_write_config_byte(dev, AMD_IDE_CONFIG + offset, t); 174 174 175 - return dev->irq; 175 + return 0; 176 176 } 177 177 178 178 static u8 amd_cable_detect(ide_hwif_t *hwif)
+1 -1
drivers/ide/cmd64x.c
··· 333 333 return (dma_stat & 7) != 4; 334 334 } 335 335 336 - static unsigned int init_chipset_cmd64x(struct pci_dev *dev) 336 + static int init_chipset_cmd64x(struct pci_dev *dev) 337 337 { 338 338 u8 mrdmode = 0; 339 339
+1 -1
drivers/ide/cs5530.c
··· 135 135 * Initialize the cs5530 bridge for reliable IDE DMA operation. 136 136 */ 137 137 138 - static unsigned int init_chipset_cs5530(struct pci_dev *dev) 138 + static int init_chipset_cs5530(struct pci_dev *dev) 139 139 { 140 140 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 141 141
+1 -1
drivers/ide/delkin_cb.c
··· 46 46 .quirkproc = ide_undecoded_slave, 47 47 }; 48 48 49 - static unsigned int delkin_cb_init_chipset(struct pci_dev *dev) 49 + static int delkin_cb_init_chipset(struct pci_dev *dev) 50 50 { 51 51 unsigned long base = pci_resource_start(dev, 0); 52 52 int i;
+2 -2
drivers/ide/hpt366.c
··· 995 995 pci_write_config_byte(dev, mcr_addr + 1, new_mcr); 996 996 } 997 997 998 - static unsigned int init_chipset_hpt366(struct pci_dev *dev) 998 + static int init_chipset_hpt366(struct pci_dev *dev) 999 999 { 1000 1000 unsigned long io_base = pci_resource_start(dev, 4); 1001 1001 struct hpt_info *info = hpt3xx_get_info(&dev->dev); ··· 1237 1237 hpt3xx_disable_fast_irq(dev, 0x50); 1238 1238 hpt3xx_disable_fast_irq(dev, 0x54); 1239 1239 1240 - return dev->irq; 1240 + return 0; 1241 1241 } 1242 1242 1243 1243 static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)
+1 -1
drivers/ide/it821x.c
··· 603 603 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 604 604 } 605 605 606 - static unsigned int init_chipset_it821x(struct pci_dev *dev) 606 + static int init_chipset_it821x(struct pci_dev *dev) 607 607 { 608 608 u8 conf; 609 609 static char *mode[2] = { "pass through", "smart" };
+2 -2
drivers/ide/pdc202xx_new.c
··· 325 325 } 326 326 #endif /* CONFIG_PPC_PMAC */ 327 327 328 - static unsigned int init_chipset_pdcnew(struct pci_dev *dev) 328 + static int init_chipset_pdcnew(struct pci_dev *dev) 329 329 { 330 330 const char *name = DRV_NAME; 331 331 unsigned long dma_base = pci_resource_start(dev, 4); ··· 444 444 #endif 445 445 446 446 out: 447 - return dev->irq; 447 + return 0; 448 448 } 449 449 450 450 static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev)
+2 -2
drivers/ide/pdc202xx_old.c
··· 264 264 ide_dma_timeout(drive); 265 265 } 266 266 267 - static unsigned int init_chipset_pdc202xx(struct pci_dev *dev) 267 + static int init_chipset_pdc202xx(struct pci_dev *dev) 268 268 { 269 269 unsigned long dmabase = pci_resource_start(dev, 4); 270 270 u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0; ··· 290 290 printk("%sACTIVE\n", (inb(dmabase | 0x1f) & 1) ? "" : "IN"); 291 291 } 292 292 out: 293 - return dev->irq; 293 + return 0; 294 294 } 295 295 296 296 static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
+1 -1
drivers/ide/piix.c
··· 204 204 * out to be nice and simple. 205 205 */ 206 206 207 - static unsigned int init_chipset_ich(struct pci_dev *dev) 207 + static int init_chipset_ich(struct pci_dev *dev) 208 208 { 209 209 u32 extra = 0; 210 210
+2 -2
drivers/ide/serverworks.c
··· 175 175 pci_write_config_byte(dev, 0x54, ultra_enable); 176 176 } 177 177 178 - static unsigned int init_chipset_svwks(struct pci_dev *dev) 178 + static int init_chipset_svwks(struct pci_dev *dev) 179 179 { 180 180 unsigned int reg; 181 181 u8 btr; ··· 270 270 pci_write_config_byte(dev, 0x5A, btr); 271 271 } 272 272 273 - return dev->irq; 273 + return 0; 274 274 } 275 275 276 276 static u8 ata66_svwks_svwks(ide_hwif_t *hwif)
+1 -1
drivers/ide/setup-pci.c
··· 524 524 if (noisy) 525 525 printk(KERN_INFO "%s %s: not 100%% native mode: will " 526 526 "probe irqs later\n", d->name, pci_name(dev)); 527 - pciirq = ret; 527 + pciirq = 0; 528 528 } else if (!pciirq && noisy) { 529 529 printk(KERN_WARNING "%s %s: bad irq (%d): will probe later\n", 530 530 d->name, pci_name(dev), pciirq);
+1 -1
drivers/ide/siimage.c
··· 464 464 * to 133 MHz clocking if the system isn't already set up to do it. 465 465 */ 466 466 467 - static unsigned int init_chipset_siimage(struct pci_dev *dev) 467 + static int init_chipset_siimage(struct pci_dev *dev) 468 468 { 469 469 struct ide_host *host = pci_get_drvdata(dev); 470 470 void __iomem *ioaddr = host->host_priv;
+1 -1
drivers/ide/sis5513.c
··· 447 447 return chipset_family; 448 448 } 449 449 450 - static unsigned int init_chipset_sis5513(struct pci_dev *dev) 450 + static int init_chipset_sis5513(struct pci_dev *dev) 451 451 { 452 452 /* Make general config ops here 453 453 1/ tell IDE channels to operate in Compatibility mode only
+2 -2
drivers/ide/sl82c105.c
··· 271 271 * channel 0 here at least, but channel 1 has to be enabled by 272 272 * firmware or arch code. We still set both to 16 bits mode. 273 273 */ 274 - static unsigned int init_chipset_sl82c105(struct pci_dev *dev) 274 + static int init_chipset_sl82c105(struct pci_dev *dev) 275 275 { 276 276 u32 val; 277 277 ··· 281 281 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 282 282 pci_write_config_dword(dev, 0x40, val); 283 283 284 - return dev->irq; 284 + return 0; 285 285 } 286 286 287 287 static const struct ide_port_ops sl82c105_port_ops = {
+1 -1
drivers/ide/via82cxxx.c
··· 267 267 * and initialize its drive independent registers. 268 268 */ 269 269 270 - static unsigned int init_chipset_via82cxxx(struct pci_dev *dev) 270 + static int init_chipset_via82cxxx(struct pci_dev *dev) 271 271 { 272 272 struct ide_host *host = pci_get_drvdata(dev); 273 273 struct via82cxxx_dev *vdev = host->host_priv;
+2 -2
include/linux/ide.h
··· 851 851 ide_hwif_t *ports[MAX_HOST_PORTS + 1]; 852 852 unsigned int n_ports; 853 853 struct device *dev[2]; 854 - unsigned int (*init_chipset)(struct pci_dev *); 854 + int (*init_chipset)(struct pci_dev *); 855 855 irq_handler_t irq_handler; 856 856 unsigned long host_flags; 857 857 void *host_priv; ··· 1361 1361 1362 1362 struct ide_port_info { 1363 1363 char *name; 1364 - unsigned int (*init_chipset)(struct pci_dev *); 1364 + int (*init_chipset)(struct pci_dev *); 1365 1365 void (*init_iops)(ide_hwif_t *); 1366 1366 void (*init_hwif)(ide_hwif_t *); 1367 1367 int (*init_dma)(ide_hwif_t *,