diff options
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 141 |
1 files changed, 69 insertions, 72 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index b43172aee4c..1abec687865 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -267,7 +267,7 @@ static enum si_sm_result start_next_msg(struct smi_info *smi_info) | |||
267 | entry = smi_info->xmit_msgs.next; | 267 | entry = smi_info->xmit_msgs.next; |
268 | } | 268 | } |
269 | 269 | ||
270 | if (!entry) { | 270 | if (! entry) { |
271 | smi_info->curr_msg = NULL; | 271 | smi_info->curr_msg = NULL; |
272 | rv = SI_SM_IDLE; | 272 | rv = SI_SM_IDLE; |
273 | } else { | 273 | } else { |
@@ -328,7 +328,7 @@ static void start_clear_flags(struct smi_info *smi_info) | |||
328 | memory, we will re-enable the interrupt. */ | 328 | memory, we will re-enable the interrupt. */ |
329 | static inline void disable_si_irq(struct smi_info *smi_info) | 329 | static inline void disable_si_irq(struct smi_info *smi_info) |
330 | { | 330 | { |
331 | if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { | 331 | if ((smi_info->irq) && (! smi_info->interrupt_disabled)) { |
332 | disable_irq_nosync(smi_info->irq); | 332 | disable_irq_nosync(smi_info->irq); |
333 | smi_info->interrupt_disabled = 1; | 333 | smi_info->interrupt_disabled = 1; |
334 | } | 334 | } |
@@ -359,7 +359,7 @@ static void handle_flags(struct smi_info *smi_info) | |||
359 | } else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) { | 359 | } else if (smi_info->msg_flags & RECEIVE_MSG_AVAIL) { |
360 | /* Messages available. */ | 360 | /* Messages available. */ |
361 | smi_info->curr_msg = ipmi_alloc_smi_msg(); | 361 | smi_info->curr_msg = ipmi_alloc_smi_msg(); |
362 | if (!smi_info->curr_msg) { | 362 | if (! smi_info->curr_msg) { |
363 | disable_si_irq(smi_info); | 363 | disable_si_irq(smi_info); |
364 | smi_info->si_state = SI_NORMAL; | 364 | smi_info->si_state = SI_NORMAL; |
365 | return; | 365 | return; |
@@ -378,7 +378,7 @@ static void handle_flags(struct smi_info *smi_info) | |||
378 | } else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) { | 378 | } else if (smi_info->msg_flags & EVENT_MSG_BUFFER_FULL) { |
379 | /* Events available. */ | 379 | /* Events available. */ |
380 | smi_info->curr_msg = ipmi_alloc_smi_msg(); | 380 | smi_info->curr_msg = ipmi_alloc_smi_msg(); |
381 | if (!smi_info->curr_msg) { | 381 | if (! smi_info->curr_msg) { |
382 | disable_si_irq(smi_info); | 382 | disable_si_irq(smi_info); |
383 | smi_info->si_state = SI_NORMAL; | 383 | smi_info->si_state = SI_NORMAL; |
384 | return; | 384 | return; |
@@ -414,7 +414,7 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
414 | #endif | 414 | #endif |
415 | switch (smi_info->si_state) { | 415 | switch (smi_info->si_state) { |
416 | case SI_NORMAL: | 416 | case SI_NORMAL: |
417 | if (!smi_info->curr_msg) | 417 | if (! smi_info->curr_msg) |
418 | break; | 418 | break; |
419 | 419 | ||
420 | smi_info->curr_msg->rsp_size | 420 | smi_info->curr_msg->rsp_size |
@@ -1047,7 +1047,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1047 | { | 1047 | { |
1048 | int rv; | 1048 | int rv; |
1049 | 1049 | ||
1050 | if (!info->irq) | 1050 | if (! info->irq) |
1051 | return 0; | 1051 | return 0; |
1052 | 1052 | ||
1053 | if (info->si_type == SI_BT) { | 1053 | if (info->si_type == SI_BT) { |
@@ -1056,7 +1056,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1056 | SA_INTERRUPT, | 1056 | SA_INTERRUPT, |
1057 | DEVICE_NAME, | 1057 | DEVICE_NAME, |
1058 | info); | 1058 | info); |
1059 | if (!rv) | 1059 | if (! rv) |
1060 | /* Enable the interrupt in the BT interface. */ | 1060 | /* Enable the interrupt in the BT interface. */ |
1061 | info->io.outputb(&info->io, IPMI_BT_INTMASK_REG, | 1061 | info->io.outputb(&info->io, IPMI_BT_INTMASK_REG, |
1062 | IPMI_BT_INTMASK_ENABLE_IRQ_BIT); | 1062 | IPMI_BT_INTMASK_ENABLE_IRQ_BIT); |
@@ -1081,7 +1081,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1081 | 1081 | ||
1082 | static void std_irq_cleanup(struct smi_info *info) | 1082 | static void std_irq_cleanup(struct smi_info *info) |
1083 | { | 1083 | { |
1084 | if (!info->irq) | 1084 | if (! info->irq) |
1085 | return; | 1085 | return; |
1086 | 1086 | ||
1087 | if (info->si_type == SI_BT) | 1087 | if (info->si_type == SI_BT) |
@@ -1154,7 +1154,7 @@ static int port_setup(struct smi_info *info) | |||
1154 | unsigned int *addr = info->io.info; | 1154 | unsigned int *addr = info->io.info; |
1155 | int mapsize; | 1155 | int mapsize; |
1156 | 1156 | ||
1157 | if (!addr || (!*addr)) | 1157 | if (! addr || (! *addr)) |
1158 | return -ENODEV; | 1158 | return -ENODEV; |
1159 | 1159 | ||
1160 | info->io_cleanup = port_cleanup; | 1160 | info->io_cleanup = port_cleanup; |
@@ -1197,15 +1197,15 @@ static int try_init_port(int intf_num, struct smi_info **new_info) | |||
1197 | { | 1197 | { |
1198 | struct smi_info *info; | 1198 | struct smi_info *info; |
1199 | 1199 | ||
1200 | if (!ports[intf_num]) | 1200 | if (! ports[intf_num]) |
1201 | return -ENODEV; | 1201 | return -ENODEV; |
1202 | 1202 | ||
1203 | if (!is_new_interface(intf_num, IPMI_IO_ADDR_SPACE, | 1203 | if (! is_new_interface(intf_num, IPMI_IO_ADDR_SPACE, |
1204 | ports[intf_num])) | 1204 | ports[intf_num])) |
1205 | return -ENODEV; | 1205 | return -ENODEV; |
1206 | 1206 | ||
1207 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1207 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1208 | if (!info) { | 1208 | if (! info) { |
1209 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (1)\n"); | 1209 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (1)\n"); |
1210 | return -ENOMEM; | 1210 | return -ENOMEM; |
1211 | } | 1211 | } |
@@ -1215,10 +1215,10 @@ static int try_init_port(int intf_num, struct smi_info **new_info) | |||
1215 | info->io.info = &(ports[intf_num]); | 1215 | info->io.info = &(ports[intf_num]); |
1216 | info->io.addr = NULL; | 1216 | info->io.addr = NULL; |
1217 | info->io.regspacing = regspacings[intf_num]; | 1217 | info->io.regspacing = regspacings[intf_num]; |
1218 | if (!info->io.regspacing) | 1218 | if (! info->io.regspacing) |
1219 | info->io.regspacing = DEFAULT_REGSPACING; | 1219 | info->io.regspacing = DEFAULT_REGSPACING; |
1220 | info->io.regsize = regsizes[intf_num]; | 1220 | info->io.regsize = regsizes[intf_num]; |
1221 | if (!info->io.regsize) | 1221 | if (! info->io.regsize) |
1222 | info->io.regsize = DEFAULT_REGSPACING; | 1222 | info->io.regsize = DEFAULT_REGSPACING; |
1223 | info->io.regshift = regshifts[intf_num]; | 1223 | info->io.regshift = regshifts[intf_num]; |
1224 | info->irq = 0; | 1224 | info->irq = 0; |
@@ -1303,7 +1303,7 @@ static int mem_setup(struct smi_info *info) | |||
1303 | unsigned long *addr = info->io.info; | 1303 | unsigned long *addr = info->io.info; |
1304 | int mapsize; | 1304 | int mapsize; |
1305 | 1305 | ||
1306 | if (!addr || (!*addr)) | 1306 | if (! addr || (! *addr)) |
1307 | return -ENODEV; | 1307 | return -ENODEV; |
1308 | 1308 | ||
1309 | info->io_cleanup = mem_cleanup; | 1309 | info->io_cleanup = mem_cleanup; |
@@ -1358,15 +1358,15 @@ static int try_init_mem(int intf_num, struct smi_info **new_info) | |||
1358 | { | 1358 | { |
1359 | struct smi_info *info; | 1359 | struct smi_info *info; |
1360 | 1360 | ||
1361 | if (!addrs[intf_num]) | 1361 | if (! addrs[intf_num]) |
1362 | return -ENODEV; | 1362 | return -ENODEV; |
1363 | 1363 | ||
1364 | if (!is_new_interface(intf_num, IPMI_MEM_ADDR_SPACE, | 1364 | if (! is_new_interface(intf_num, IPMI_MEM_ADDR_SPACE, |
1365 | addrs[intf_num])) | 1365 | addrs[intf_num])) |
1366 | return -ENODEV; | 1366 | return -ENODEV; |
1367 | 1367 | ||
1368 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1368 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1369 | if (!info) { | 1369 | if (! info) { |
1370 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (2)\n"); | 1370 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (2)\n"); |
1371 | return -ENOMEM; | 1371 | return -ENOMEM; |
1372 | } | 1372 | } |
@@ -1376,10 +1376,10 @@ static int try_init_mem(int intf_num, struct smi_info **new_info) | |||
1376 | info->io.info = &addrs[intf_num]; | 1376 | info->io.info = &addrs[intf_num]; |
1377 | info->io.addr = NULL; | 1377 | info->io.addr = NULL; |
1378 | info->io.regspacing = regspacings[intf_num]; | 1378 | info->io.regspacing = regspacings[intf_num]; |
1379 | if (!info->io.regspacing) | 1379 | if (! info->io.regspacing) |
1380 | info->io.regspacing = DEFAULT_REGSPACING; | 1380 | info->io.regspacing = DEFAULT_REGSPACING; |
1381 | info->io.regsize = regsizes[intf_num]; | 1381 | info->io.regsize = regsizes[intf_num]; |
1382 | if (!info->io.regsize) | 1382 | if (! info->io.regsize) |
1383 | info->io.regsize = DEFAULT_REGSPACING; | 1383 | info->io.regsize = DEFAULT_REGSPACING; |
1384 | info->io.regshift = regshifts[intf_num]; | 1384 | info->io.regshift = regshifts[intf_num]; |
1385 | info->irq = 0; | 1385 | info->irq = 0; |
@@ -1437,7 +1437,7 @@ static int acpi_gpe_irq_setup(struct smi_info *info) | |||
1437 | { | 1437 | { |
1438 | acpi_status status; | 1438 | acpi_status status; |
1439 | 1439 | ||
1440 | if (!info->irq) | 1440 | if (! info->irq) |
1441 | return 0; | 1441 | return 0; |
1442 | 1442 | ||
1443 | /* FIXME - is level triggered right? */ | 1443 | /* FIXME - is level triggered right? */ |
@@ -1461,7 +1461,7 @@ static int acpi_gpe_irq_setup(struct smi_info *info) | |||
1461 | 1461 | ||
1462 | static void acpi_gpe_irq_cleanup(struct smi_info *info) | 1462 | static void acpi_gpe_irq_cleanup(struct smi_info *info) |
1463 | { | 1463 | { |
1464 | if (!info->irq) | 1464 | if (! info->irq) |
1465 | return; | 1465 | return; |
1466 | 1466 | ||
1467 | acpi_remove_gpe_handler(NULL, info->irq, &ipmi_acpi_gpe); | 1467 | acpi_remove_gpe_handler(NULL, info->irq, &ipmi_acpi_gpe); |
@@ -1537,10 +1537,10 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1537 | addr_space = IPMI_MEM_ADDR_SPACE; | 1537 | addr_space = IPMI_MEM_ADDR_SPACE; |
1538 | else | 1538 | else |
1539 | addr_space = IPMI_IO_ADDR_SPACE; | 1539 | addr_space = IPMI_IO_ADDR_SPACE; |
1540 | if (!is_new_interface(-1, addr_space, spmi->addr.address)) | 1540 | if (! is_new_interface(-1, addr_space, spmi->addr.address)) |
1541 | return -ENODEV; | 1541 | return -ENODEV; |
1542 | 1542 | ||
1543 | if (!spmi->addr.register_bit_width) { | 1543 | if (! spmi->addr.register_bit_width) { |
1544 | acpi_failure = 1; | 1544 | acpi_failure = 1; |
1545 | return -ENODEV; | 1545 | return -ENODEV; |
1546 | } | 1546 | } |
@@ -1567,7 +1567,7 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1569 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1570 | if (!info) { | 1570 | if (! info) { |
1571 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); | 1571 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); |
1572 | return -ENOMEM; | 1572 | return -ENOMEM; |
1573 | } | 1573 | } |
@@ -1645,7 +1645,7 @@ static int dmi_data_entries; | |||
1645 | 1645 | ||
1646 | static int __init decode_dmi(struct dmi_header *dm, int intf_num) | 1646 | static int __init decode_dmi(struct dmi_header *dm, int intf_num) |
1647 | { | 1647 | { |
1648 | u8 *data = (u8 *)dm; | 1648 | u8 *data = (u8 *)dm; |
1649 | unsigned long base_addr; | 1649 | unsigned long base_addr; |
1650 | u8 reg_spacing; | 1650 | u8 reg_spacing; |
1651 | u8 len = dm->length; | 1651 | u8 len = dm->length; |
@@ -1714,7 +1714,7 @@ static int __init decode_dmi(struct dmi_header *dm, int intf_num) | |||
1714 | static void __init dmi_find_bmc(void) | 1714 | static void __init dmi_find_bmc(void) |
1715 | { | 1715 | { |
1716 | struct dmi_device *dev = NULL; | 1716 | struct dmi_device *dev = NULL; |
1717 | int intf_num = 0; | 1717 | int intf_num = 0; |
1718 | 1718 | ||
1719 | while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { | 1719 | while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { |
1720 | if (intf_num >= SI_MAX_DRIVERS) | 1720 | if (intf_num >= SI_MAX_DRIVERS) |
@@ -1726,14 +1726,14 @@ static void __init dmi_find_bmc(void) | |||
1726 | 1726 | ||
1727 | static int try_init_smbios(int intf_num, struct smi_info **new_info) | 1727 | static int try_init_smbios(int intf_num, struct smi_info **new_info) |
1728 | { | 1728 | { |
1729 | struct smi_info *info; | 1729 | struct smi_info *info; |
1730 | dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num; | 1730 | dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num; |
1731 | char *io_type; | 1731 | char *io_type; |
1732 | 1732 | ||
1733 | if (intf_num >= dmi_data_entries) | 1733 | if (intf_num >= dmi_data_entries) |
1734 | return -ENODEV; | 1734 | return -ENODEV; |
1735 | 1735 | ||
1736 | switch(ipmi_data->type) { | 1736 | switch (ipmi_data->type) { |
1737 | case 0x01: /* KCS */ | 1737 | case 0x01: /* KCS */ |
1738 | si_type[intf_num] = "kcs"; | 1738 | si_type[intf_num] = "kcs"; |
1739 | break; | 1739 | break; |
@@ -1748,7 +1748,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info) | |||
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1750 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1751 | if (!info) { | 1751 | if (! info) { |
1752 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (4)\n"); | 1752 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (4)\n"); |
1753 | return -ENOMEM; | 1753 | return -ENOMEM; |
1754 | } | 1754 | } |
@@ -1772,7 +1772,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info) | |||
1772 | 1772 | ||
1773 | regspacings[intf_num] = ipmi_data->offset; | 1773 | regspacings[intf_num] = ipmi_data->offset; |
1774 | info->io.regspacing = regspacings[intf_num]; | 1774 | info->io.regspacing = regspacings[intf_num]; |
1775 | if (!info->io.regspacing) | 1775 | if (! info->io.regspacing) |
1776 | info->io.regspacing = DEFAULT_REGSPACING; | 1776 | info->io.regspacing = DEFAULT_REGSPACING; |
1777 | info->io.regsize = DEFAULT_REGSPACING; | 1777 | info->io.regsize = DEFAULT_REGSPACING; |
1778 | info->io.regshift = regshifts[intf_num]; | 1778 | info->io.regshift = regshifts[intf_num]; |
@@ -1814,14 +1814,14 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1814 | 1814 | ||
1815 | pci_smic_checked = 1; | 1815 | pci_smic_checked = 1; |
1816 | 1816 | ||
1817 | if ((pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, | 1817 | pci_dev = pci_get_device(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID, NULL); |
1818 | NULL))) | 1818 | if (! pci_dev) { |
1819 | ; | 1819 | pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL); |
1820 | else if ((pci_dev = pci_get_class(PCI_ERMC_CLASSCODE, NULL)) && | 1820 | if (pci_dev && (pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID)) |
1821 | pci_dev->subsystem_vendor == PCI_HP_VENDOR_ID) | 1821 | fe_rmc = 1; |
1822 | fe_rmc = 1; | 1822 | else |
1823 | else | 1823 | return -ENODEV; |
1824 | return -ENODEV; | 1824 | } |
1825 | 1825 | ||
1826 | error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr); | 1826 | error = pci_read_config_word(pci_dev, PCI_MMC_ADDR_CW, &base_addr); |
1827 | if (error) | 1827 | if (error) |
@@ -1834,7 +1834,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1834 | } | 1834 | } |
1835 | 1835 | ||
1836 | /* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */ | 1836 | /* Bit 0: 1 specifies programmed I/O, 0 specifies memory mapped I/O */ |
1837 | if (!(base_addr & 0x0001)) | 1837 | if (! (base_addr & 0x0001)) |
1838 | { | 1838 | { |
1839 | pci_dev_put(pci_dev); | 1839 | pci_dev_put(pci_dev); |
1840 | printk(KERN_ERR | 1840 | printk(KERN_ERR |
@@ -1844,17 +1844,17 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1844 | } | 1844 | } |
1845 | 1845 | ||
1846 | base_addr &= 0xFFFE; | 1846 | base_addr &= 0xFFFE; |
1847 | if (!fe_rmc) | 1847 | if (! fe_rmc) |
1848 | /* Data register starts at base address + 1 in eRMC */ | 1848 | /* Data register starts at base address + 1 in eRMC */ |
1849 | ++base_addr; | 1849 | ++base_addr; |
1850 | 1850 | ||
1851 | if (!is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) { | 1851 | if (! is_new_interface(-1, IPMI_IO_ADDR_SPACE, base_addr)) { |
1852 | pci_dev_put(pci_dev); | 1852 | pci_dev_put(pci_dev); |
1853 | return -ENODEV; | 1853 | return -ENODEV; |
1854 | } | 1854 | } |
1855 | 1855 | ||
1856 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1856 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1857 | if (!info) { | 1857 | if (! info) { |
1858 | pci_dev_put(pci_dev); | 1858 | pci_dev_put(pci_dev); |
1859 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n"); | 1859 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (5)\n"); |
1860 | return -ENOMEM; | 1860 | return -ENOMEM; |
@@ -1865,7 +1865,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1865 | ports[intf_num] = base_addr; | 1865 | ports[intf_num] = base_addr; |
1866 | info->io.info = &(ports[intf_num]); | 1866 | info->io.info = &(ports[intf_num]); |
1867 | info->io.regspacing = regspacings[intf_num]; | 1867 | info->io.regspacing = regspacings[intf_num]; |
1868 | if (!info->io.regspacing) | 1868 | if (! info->io.regspacing) |
1869 | info->io.regspacing = DEFAULT_REGSPACING; | 1869 | info->io.regspacing = DEFAULT_REGSPACING; |
1870 | info->io.regsize = DEFAULT_REGSPACING; | 1870 | info->io.regsize = DEFAULT_REGSPACING; |
1871 | info->io.regshift = regshifts[intf_num]; | 1871 | info->io.regshift = regshifts[intf_num]; |
@@ -1886,7 +1886,7 @@ static int find_pci_smic(int intf_num, struct smi_info **new_info) | |||
1886 | static int try_init_plug_and_play(int intf_num, struct smi_info **new_info) | 1886 | static int try_init_plug_and_play(int intf_num, struct smi_info **new_info) |
1887 | { | 1887 | { |
1888 | #ifdef CONFIG_PCI | 1888 | #ifdef CONFIG_PCI |
1889 | if (find_pci_smic(intf_num, new_info)==0) | 1889 | if (find_pci_smic(intf_num, new_info) == 0) |
1890 | return 0; | 1890 | return 0; |
1891 | #endif | 1891 | #endif |
1892 | /* Include other methods here. */ | 1892 | /* Include other methods here. */ |
@@ -1904,7 +1904,7 @@ static int try_get_dev_id(struct smi_info *smi_info) | |||
1904 | int rv = 0; | 1904 | int rv = 0; |
1905 | 1905 | ||
1906 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); | 1906 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); |
1907 | if (!resp) | 1907 | if (! resp) |
1908 | return -ENOMEM; | 1908 | return -ENOMEM; |
1909 | 1909 | ||
1910 | /* Do a Get Device ID command, since it comes back with some | 1910 | /* Do a Get Device ID command, since it comes back with some |
@@ -1986,7 +1986,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
1986 | struct smi_info *smi = data; | 1986 | struct smi_info *smi = data; |
1987 | 1987 | ||
1988 | out += sprintf(out, "interrupts_enabled: %d\n", | 1988 | out += sprintf(out, "interrupts_enabled: %d\n", |
1989 | smi->irq && !smi->interrupt_disabled); | 1989 | smi->irq && ! smi->interrupt_disabled); |
1990 | out += sprintf(out, "short_timeouts: %ld\n", | 1990 | out += sprintf(out, "short_timeouts: %ld\n", |
1991 | smi->short_timeouts); | 1991 | smi->short_timeouts); |
1992 | out += sprintf(out, "long_timeouts: %ld\n", | 1992 | out += sprintf(out, "long_timeouts: %ld\n", |
@@ -2024,8 +2024,8 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
2024 | */ | 2024 | */ |
2025 | static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info) | 2025 | static int oem_data_avail_to_receive_msg_avail(struct smi_info *smi_info) |
2026 | { | 2026 | { |
2027 | smi_info->msg_flags = (smi_info->msg_flags & ~OEM_DATA_AVAIL) | | 2027 | smi_info->msg_flags = ((smi_info->msg_flags & ~OEM_DATA_AVAIL) | |
2028 | RECEIVE_MSG_AVAIL; | 2028 | RECEIVE_MSG_AVAIL); |
2029 | return 1; | 2029 | return 1; |
2030 | } | 2030 | } |
2031 | 2031 | ||
@@ -2059,10 +2059,11 @@ static void setup_dell_poweredge_oem_data_handler(struct smi_info *smi_info) | |||
2059 | { | 2059 | { |
2060 | struct ipmi_device_id *id = &smi_info->device_id; | 2060 | struct ipmi_device_id *id = &smi_info->device_id; |
2061 | const char mfr[3]=DELL_IANA_MFR_ID; | 2061 | const char mfr[3]=DELL_IANA_MFR_ID; |
2062 | if (!memcmp(mfr, id->manufacturer_id, sizeof(mfr)) && | 2062 | if (! memcmp(mfr, id->manufacturer_id, sizeof(mfr)) |
2063 | id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID && | 2063 | && (id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID) |
2064 | id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV && | 2064 | && (id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV) |
2065 | id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION) { | 2065 | && (id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION)) |
2066 | { | ||
2066 | smi_info->oem_data_avail_handler = | 2067 | smi_info->oem_data_avail_handler = |
2067 | oem_data_avail_to_receive_msg_avail; | 2068 | oem_data_avail_to_receive_msg_avail; |
2068 | } | 2069 | } |
@@ -2092,19 +2093,15 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2092 | if (rv) | 2093 | if (rv) |
2093 | rv = try_init_port(intf_num, &new_smi); | 2094 | rv = try_init_port(intf_num, &new_smi); |
2094 | #ifdef CONFIG_ACPI_INTERPRETER | 2095 | #ifdef CONFIG_ACPI_INTERPRETER |
2095 | if ((rv) && (si_trydefaults)) { | 2096 | if (rv && si_trydefaults) |
2096 | rv = try_init_acpi(intf_num, &new_smi); | 2097 | rv = try_init_acpi(intf_num, &new_smi); |
2097 | } | ||
2098 | #endif | 2098 | #endif |
2099 | #ifdef CONFIG_X86 | 2099 | #ifdef CONFIG_X86 |
2100 | if ((rv) && (si_trydefaults)) { | 2100 | if (rv && si_trydefaults) |
2101 | rv = try_init_smbios(intf_num, &new_smi); | 2101 | rv = try_init_smbios(intf_num, &new_smi); |
2102 | } | ||
2103 | #endif | 2102 | #endif |
2104 | if ((rv) && (si_trydefaults)) { | 2103 | if (rv && si_trydefaults) |
2105 | rv = try_init_plug_and_play(intf_num, &new_smi); | 2104 | rv = try_init_plug_and_play(intf_num, &new_smi); |
2106 | } | ||
2107 | |||
2108 | 2105 | ||
2109 | if (rv) | 2106 | if (rv) |
2110 | return rv; | 2107 | return rv; |
@@ -2114,7 +2111,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2114 | new_smi->si_sm = NULL; | 2111 | new_smi->si_sm = NULL; |
2115 | new_smi->handlers = NULL; | 2112 | new_smi->handlers = NULL; |
2116 | 2113 | ||
2117 | if (!new_smi->irq_setup) { | 2114 | if (! new_smi->irq_setup) { |
2118 | new_smi->irq = irqs[intf_num]; | 2115 | new_smi->irq = irqs[intf_num]; |
2119 | new_smi->irq_setup = std_irq_setup; | 2116 | new_smi->irq_setup = std_irq_setup; |
2120 | new_smi->irq_cleanup = std_irq_cleanup; | 2117 | new_smi->irq_cleanup = std_irq_cleanup; |
@@ -2148,7 +2145,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2148 | 2145 | ||
2149 | /* Allocate the state machine's data and initialize it. */ | 2146 | /* Allocate the state machine's data and initialize it. */ |
2150 | new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); | 2147 | new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); |
2151 | if (!new_smi->si_sm) { | 2148 | if (! new_smi->si_sm) { |
2152 | printk(" Could not allocate state machine memory\n"); | 2149 | printk(" Could not allocate state machine memory\n"); |
2153 | rv = -ENOMEM; | 2150 | rv = -ENOMEM; |
2154 | goto out_err; | 2151 | goto out_err; |
@@ -2256,7 +2253,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2256 | 2253 | ||
2257 | /* Wait for the timer to stop. This avoids problems with race | 2254 | /* Wait for the timer to stop. This avoids problems with race |
2258 | conditions removing the timer here. */ | 2255 | conditions removing the timer here. */ |
2259 | while (!new_smi->timer_stopped) { | 2256 | while (! new_smi->timer_stopped) { |
2260 | set_current_state(TASK_UNINTERRUPTIBLE); | 2257 | set_current_state(TASK_UNINTERRUPTIBLE); |
2261 | schedule_timeout(1); | 2258 | schedule_timeout(1); |
2262 | } | 2259 | } |
@@ -2296,7 +2293,7 @@ static __init int init_ipmi_si(void) | |||
2296 | /* Parse out the si_type string into its components. */ | 2293 | /* Parse out the si_type string into its components. */ |
2297 | str = si_type_str; | 2294 | str = si_type_str; |
2298 | if (*str != '\0') { | 2295 | if (*str != '\0') { |
2299 | for (i=0; (i<SI_MAX_PARMS) && (*str != '\0'); i++) { | 2296 | for (i = 0; (i < SI_MAX_PARMS) && (*str != '\0'); i++) { |
2300 | si_type[i] = str; | 2297 | si_type[i] = str; |
2301 | str = strchr(str, ','); | 2298 | str = strchr(str, ','); |
2302 | if (str) { | 2299 | if (str) { |
@@ -2315,7 +2312,7 @@ static __init int init_ipmi_si(void) | |||
2315 | #endif | 2312 | #endif |
2316 | 2313 | ||
2317 | rv = init_one_smi(0, &(smi_infos[pos])); | 2314 | rv = init_one_smi(0, &(smi_infos[pos])); |
2318 | if (rv && !ports[0] && si_trydefaults) { | 2315 | if (rv && ! ports[0] && si_trydefaults) { |
2319 | /* If we are trying defaults and the initial port is | 2316 | /* If we are trying defaults and the initial port is |
2320 | not set, then set it. */ | 2317 | not set, then set it. */ |
2321 | si_type[0] = "kcs"; | 2318 | si_type[0] = "kcs"; |
@@ -2337,7 +2334,7 @@ static __init int init_ipmi_si(void) | |||
2337 | if (rv == 0) | 2334 | if (rv == 0) |
2338 | pos++; | 2335 | pos++; |
2339 | 2336 | ||
2340 | for (i=1; i < SI_MAX_PARMS; i++) { | 2337 | for (i = 1; i < SI_MAX_PARMS; i++) { |
2341 | rv = init_one_smi(i, &(smi_infos[pos])); | 2338 | rv = init_one_smi(i, &(smi_infos[pos])); |
2342 | if (rv == 0) | 2339 | if (rv == 0) |
2343 | pos++; | 2340 | pos++; |
@@ -2379,14 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean) | |||
2379 | 2376 | ||
2380 | /* Wait for the timer to stop. This avoids problems with race | 2377 | /* Wait for the timer to stop. This avoids problems with race |
2381 | conditions removing the timer here. */ | 2378 | conditions removing the timer here. */ |
2382 | while (!to_clean->timer_stopped) { | 2379 | while (! to_clean->timer_stopped) { |
2383 | set_current_state(TASK_UNINTERRUPTIBLE); | 2380 | set_current_state(TASK_UNINTERRUPTIBLE); |
2384 | schedule_timeout(1); | 2381 | schedule_timeout(1); |
2385 | } | 2382 | } |
2386 | 2383 | ||
2387 | /* Interrupts and timeouts are stopped, now make sure the | 2384 | /* Interrupts and timeouts are stopped, now make sure the |
2388 | interface is in a clean state. */ | 2385 | interface is in a clean state. */ |
2389 | while ((to_clean->curr_msg) || (to_clean->si_state != SI_NORMAL)) { | 2386 | while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { |
2390 | poll(to_clean); | 2387 | poll(to_clean); |
2391 | set_current_state(TASK_UNINTERRUPTIBLE); | 2388 | set_current_state(TASK_UNINTERRUPTIBLE); |
2392 | schedule_timeout(1); | 2389 | schedule_timeout(1); |
@@ -2410,10 +2407,10 @@ static __exit void cleanup_ipmi_si(void) | |||
2410 | { | 2407 | { |
2411 | int i; | 2408 | int i; |
2412 | 2409 | ||
2413 | if (!initialized) | 2410 | if (! initialized) |
2414 | return; | 2411 | return; |
2415 | 2412 | ||
2416 | for (i=0; i<SI_MAX_DRIVERS; i++) { | 2413 | for (i = 0; i < SI_MAX_DRIVERS; i++) { |
2417 | cleanup_one_si(smi_infos[i]); | 2414 | cleanup_one_si(smi_infos[i]); |
2418 | } | 2415 | } |
2419 | } | 2416 | } |