Pull IPMI updates from Corey Minyard: "A bunch of little cleanups Nothing major, no functional changes" * tag 'for-linus-5.13-1' of git://github.com/cminyard/linux-ipmi: ipmi_si: Join string literals back ipmi_si: Drop redundant check before calling put_device() ipmi_si: Use strstrip() to remove surrounding spaces ipmi_si: Get rid of ->addr_source_cleanup() ipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one() ipmi_si: Introduce ipmi_panic_event_str[] array ipmi_si: Use proper ACPI macros to check error code for failures ipmi_si: Utilize temporary variable to hold device pointer ipmi_si: Remove bogus err_free label ipmi_si: Switch to use platform_get_mem_or_io() ipmi: Handle device properties with software node API ipmi:ssif: make ssif_i2c_send() void ipmi: Refine retry conditions for getting device id
Unified · Split
| @@ -49,11 +49,17 @@ static int handle_one_recv_msg(struct ipmi_smi *intf, · 48 unmodified lines | |||
| 49 | static bool initialized; | 49 | static bool initialized; |
| 50 | static bool drvregistered; | 50 | static bool drvregistered; |
| 51 | 51 | ||
| 52 | /* Numbers in this enumerator should be mapped to ipmi_panic_event_str */ | ||
| 52 | enum ipmi_panic_event_op { | 53 | enum ipmi_panic_event_op { |
| 53 | IPMI_SEND_PANIC_EVENT_NONE, | 54 | IPMI_SEND_PANIC_EVENT_NONE, |
| 54 | IPMI_SEND_PANIC_EVENT, | 55 | IPMI_SEND_PANIC_EVENT, |
| 55 | IPMI_SEND_PANIC_EVENT_STRING | 56 | IPMI_SEND_PANIC_EVENT_STRING, |
| 57 | IPMI_SEND_PANIC_EVENT_MAX | ||
| 56 | }; | 58 | }; |
| 59 | |||
| 60 | /* Indices in this array should be mapped to enum ipmi_panic_event_op */ | ||
| 61 | static const char *const ipmi_panic_event_str[] = { "none", "event", "string", NULL }; | ||
| 62 | |||
| 57 | #ifdef CONFIG_IPMI_PANIC_STRING | 63 | #ifdef CONFIG_IPMI_PANIC_STRING |
| 58 | #define IPMI_PANIC_DEFAULT IPMI_SEND_PANIC_EVENT_STRING | 64 | #define IPMI_PANIC_DEFAULT IPMI_SEND_PANIC_EVENT_STRING |
| 59 | #elif defined(CONFIG_IPMI_PANIC_EVENT) | 65 | #elif defined(CONFIG_IPMI_PANIC_EVENT) |
| @@ -68,46 +74,27 @@ static int panic_op_write_handler(const char *val, · 8 unmodified lines | |||
| 68 | const struct kernel_param *kp) | 74 | const struct kernel_param *kp) |
| 69 | { | 75 | { |
| 70 | char valcp[16]; | 76 | char valcp[16]; |
| 71 | char *s; | 77 | int e; |
| 72 | |||
| 73 | strncpy(valcp, val, 15); | ||
| 74 | valcp[15] = '\0'; | ||
| 75 | 78 | ||
| 76 | s = strstrip(valcp); | 79 | strscpy(valcp, val, sizeof(valcp)); |
| 77 | 80 | e = match_string(ipmi_panic_event_str, -1, strstrip(valcp)); | |
| 78 | if (strcmp(s, "none") == 0) | 81 | if (e < 0) |
| 79 | ipmi_send_panic_event = IPMI_SEND_PANIC_EVENT_NONE; | 82 | return e; |
| 80 | else if (strcmp(s, "event") == 0) | ||
| 81 | ipmi_send_panic_event = IPMI_SEND_PANIC_EVENT; | ||
| 82 | else if (strcmp(s, "string") == 0) | ||
| 83 | ipmi_send_panic_event = IPMI_SEND_PANIC_EVENT_STRING; | ||
| 84 | else | ||
| 85 | return -EINVAL; | ||
| 86 | 83 | ||
| 84 | ipmi_send_panic_event = e; | ||
| 87 | return 0; | 85 | return 0; |
| 88 | } | 86 | } |
| 89 | 87 | ||
| 90 | static int panic_op_read_handler(char *buffer, const struct kernel_param *kp) | 88 | static int panic_op_read_handler(char *buffer, const struct kernel_param *kp) |
| 91 | { | 89 | { |
| 92 | switch (ipmi_send_panic_event) { | 90 | const char *event_str; |
| 93 | case IPMI_SEND_PANIC_EVENT_NONE: | ||
| 94 | strcpy(buffer, "none\n"); | ||
| 95 | break; | ||
| 96 | |||
| 97 | case IPMI_SEND_PANIC_EVENT: | ||
| 98 | strcpy(buffer, "event\n"); | ||
| 99 | break; | ||
| 100 | |||
| 101 | case IPMI_SEND_PANIC_EVENT_STRING: | ||
| 102 | strcpy(buffer, "string\n"); | ||
| 103 | break; | ||
| 104 | 91 | ||
| 105 | default: | 92 | if (ipmi_send_panic_event >= IPMI_SEND_PANIC_EVENT_MAX) |
| 106 | strcpy(buffer, "???\n"); | 93 | event_str = "???"; |
| 107 | break; | 94 | else |
| 108 | } | 95 | event_str = ipmi_panic_event_str[ipmi_send_panic_event]; |
| 109 | 96 | ||
| 110 | return strlen(buffer); | 97 | return sprintf(buffer, "%s\n", event_str); |
| 111 | } | 98 | } |
| 112 | 99 | ||
| 113 | static const struct kernel_param_ops panic_op_ops = { | 100 | static const struct kernel_param_ops panic_op_ops = { |
| @@ -2447,10 +2434,8 @@ retry: · 2333 unmodified lines | |||
| 2447 | wait_event(intf->waitq, bmc->dyn_id_set != 2); | 2434 | wait_event(intf->waitq, bmc->dyn_id_set != 2); |
| 2448 | 2435 | ||
| 2449 | if (!bmc->dyn_id_set) { | 2436 | if (!bmc->dyn_id_set) { |
| 2450 | if ((bmc->cc == IPMI_DEVICE_IN_FW_UPDATE_ERR | 2437 | if (bmc->cc != IPMI_CC_NO_ERROR && |
| 2451 | || bmc->cc == IPMI_DEVICE_IN_INIT_ERR | 2438 | ++retry_count <= GET_DEVICE_ID_MAX_RETRY) { |
| 2452 | || bmc->cc == IPMI_NOT_IN_MY_STATE_ERR) | ||
| 2453 | && ++retry_count <= GET_DEVICE_ID_MAX_RETRY) { | ||
| 2454 | msleep(500); | 2439 | msleep(500); |
| 2455 | dev_warn(intf->si_dev, | 2440 | dev_warn(intf->si_dev, |
| 2456 | "BMC returned 0x%2.2x, retry get bmc device id\n", | 2441 | "BMC returned 0x%2.2x, retry get bmc device id\n", |
| @@ -5224,7 +5209,6 @@ module_exit(cleanup_ipmi); · 2767 unmodified lines | |||
| 5224 | module_init(ipmi_init_msghandler_mod); | 5209 | module_init(ipmi_init_msghandler_mod); |
| 5225 | MODULE_LICENSE("GPL"); | 5210 | MODULE_LICENSE("GPL"); |
| 5226 | MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); | 5211 | MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); |
| 5227 | MODULE_DESCRIPTION("Incoming and outgoing message routing for an IPMI" | 5212 | MODULE_DESCRIPTION("Incoming and outgoing message routing for an IPMI interface."); |
| 5228 | " interface."); | ||
| 5229 | MODULE_VERSION(IPMI_DRIVER_VERSION); | 5213 | MODULE_VERSION(IPMI_DRIVER_VERSION); |
| 5230 | MODULE_SOFTDEP("post: ipmi_devintf"); | 5214 | MODULE_SOFTDEP("post: ipmi_devintf"); |
| @@ -102,7 +102,7 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst, · 101 unmodified lines | |||
| 102 | goto err; | 102 | goto err; |
| 103 | } | 103 | } |
| 104 | add_properties: | 104 | add_properties: |
| 105 | rv = platform_device_add_properties(pdev, pr); | 105 | rv = device_create_managed_software_node(&pdev->dev, pr, NULL); |
| 106 | if (rv) { | 106 | if (rv) { |
| 107 | dev_err(&pdev->dev, | 107 | dev_err(&pdev->dev, |
| 108 | "Unable to add hard-code properties: %d\n", rv); | 108 | "Unable to add hard-code properties: %d\n", rv); |
| @@ -18,10 +18,14 @@ · 17 unmodified lines | |||
| 18 | #define DEFAULT_REGSPACING 1 | 18 | #define DEFAULT_REGSPACING 1 |
| 19 | #define DEFAULT_REGSIZE 1 | 19 | #define DEFAULT_REGSIZE 1 |
| 20 | 20 | ||
| 21 | /* Numbers in this enumerator should be mapped to si_to_str[] */ | ||
| 21 | enum si_type { | 22 | enum si_type { |
| 22 | SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT | 23 | SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT, SI_TYPE_MAX |
| 23 | }; | 24 | }; |
| 24 | 25 | ||
| 26 | /* Array is defined in the ipmi_si_intf.c */ | ||
| 27 | extern const char *const si_to_str[]; | ||
| 28 | |||
| 25 | enum ipmi_addr_space { | 29 | enum ipmi_addr_space { |
| 26 | IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE | 30 | IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE |
| 27 | }; | 31 | }; |
| @@ -48,8 +52,6 @@ struct si_sm_io { · 20 unmodified lines | |||
| 48 | enum ipmi_addr_space addr_space; | 52 | enum ipmi_addr_space addr_space; |
| 49 | unsigned long addr_data; | 53 | unsigned long addr_data; |
| 50 | enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */ | 54 | enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */ |
| 51 | void (*addr_source_cleanup)(struct si_sm_io *io); | ||
| 52 | void *addr_source_data; | ||
| 53 | union ipmi_smi_info_union addr_info; | 55 | union ipmi_smi_info_union addr_info; |
| 54 | 56 | ||
| 55 | int (*io_setup)(struct si_sm_io *info); | 57 | int (*io_setup)(struct si_sm_io *info); |
| @@ -32,47 +32,29 @@ static int slave_addrs[SI_MAX_PARMS] __initdata; · 31 unmodified lines | |||
| 32 | static unsigned int num_slave_addrs __initdata; | 32 | static unsigned int num_slave_addrs __initdata; |
| 33 | 33 | ||
| 34 | module_param_string(type, si_type_str, MAX_SI_TYPE_STR, 0); | 34 | module_param_string(type, si_type_str, MAX_SI_TYPE_STR, 0); |
| 35 | MODULE_PARM_DESC(type, "Defines the type of each interface, each" | 35 | MODULE_PARM_DESC(type, |
| 36 | " interface separated by commas. The types are 'kcs'," | 36 | "Defines the type of each interface, each interface separated by commas. The types are 'kcs', 'smic', and 'bt'. For example si_type=kcs,bt will set the first interface to kcs and the second to bt"); |
| 37 | " 'smic', and 'bt'. For example si_type=kcs,bt will set" | ||
| 38 | " the first interface to kcs and the second to bt"); | ||
| 39 | module_param_hw_array(addrs, ulong, iomem, &num_addrs, 0); | 37 | module_param_hw_array(addrs, ulong, iomem, &num_addrs, 0); |
| 40 | MODULE_PARM_DESC(addrs, "Sets the memory address of each interface, the" | 38 | MODULE_PARM_DESC(addrs, |
| 41 | " addresses separated by commas. Only use if an interface" | 39 | "Sets the memory address of each interface, the addresses separated by commas. Only use if an interface is in memory. Otherwise, set it to zero or leave it blank."); |
| 42 | " is in memory. Otherwise, set it to zero or leave" | ||
| 43 | " it blank."); | ||
| 44 | module_param_hw_array(ports, uint, ioport, &num_ports, 0); | 40 | module_param_hw_array(ports, uint, ioport, &num_ports, 0); |
| 45 | MODULE_PARM_DESC(ports, "Sets the port address of each interface, the" | 41 | MODULE_PARM_DESC(ports, |
| 46 | " addresses separated by commas. Only use if an interface" | 42 | "Sets the port address of each interface, the addresses separated by commas. Only use if an interface is a port. Otherwise, set it to zero or leave it blank."); |
| 47 | " is a port. Otherwise, set it to zero or leave" | ||
| 48 | " it blank."); | ||
| 49 | module_param_hw_array(irqs, int, irq, &num_irqs, 0); | 43 | module_param_hw_array(irqs, int, irq, &num_irqs, 0); |
| 50 | MODULE_PARM_DESC(irqs, "Sets the interrupt of each interface, the" | 44 | MODULE_PARM_DESC(irqs, |
| 51 | " addresses separated by commas. Only use if an interface" | 45 | "Sets the interrupt of each interface, the addresses separated by commas. Only use if an interface has an interrupt. Otherwise, set it to zero or leave it blank."); |
| 52 | " has an interrupt. Otherwise, set it to zero or leave" | ||
| 53 | " it blank."); | ||
| 54 | module_param_hw_array(regspacings, int, other, &num_regspacings, 0); | 46 | module_param_hw_array(regspacings, int, other, &num_regspacings, 0); |
| 55 | MODULE_PARM_DESC(regspacings, "The number of bytes between the start address" | 47 | MODULE_PARM_DESC(regspacings, |
| 56 | " and each successive register used by the interface. For" | 48 | "The number of bytes between the start address and each successive register used by the interface. For instance, if the start address is 0xca2 and the spacing is 2, then the second address is at 0xca4. Defaults to 1."); |
| 57 | " instance, if the start address is 0xca2 and the spacing" | ||
| 58 | " is 2, then the second address is at 0xca4. Defaults" | ||
| 59 | " to 1."); | ||
| 60 | module_param_hw_array(regsizes, int, other, &num_regsizes, 0); | 49 | module_param_hw_array(regsizes, int, other, &num_regsizes, 0); |
| 61 | MODULE_PARM_DESC(regsizes, "The size of the specific IPMI register in bytes." | 50 | MODULE_PARM_DESC(regsizes, |
| 62 | " This should generally be 1, 2, 4, or 8 for an 8-bit," | 51 | "The size of the specific IPMI register in bytes. This should generally be 1, 2, 4, or 8 for an 8-bit, 16-bit, 32-bit, or 64-bit register. Use this if you the 8-bit IPMI register has to be read from a larger register."); |
| 63 | " 16-bit, 32-bit, or 64-bit register. Use this if you" | ||
| 64 | " the 8-bit IPMI register has to be read from a larger" | ||
| 65 | " register."); | ||
| 66 | module_param_hw_array(regshifts, int, other, &num_regshifts, 0); | 52 | module_param_hw_array(regshifts, int, other, &num_regshifts, 0); |
| 67 | MODULE_PARM_DESC(regshifts, "The amount to shift the data read from the." | 53 | MODULE_PARM_DESC(regshifts, |
| 68 | " IPMI register, in bits. For instance, if the data" | 54 | "The amount to shift the data read from the. IPMI register, in bits. For instance, if the data is read from a 32-bit word and the IPMI data is in bit 8-15, then the shift would be 8"); |
| 69 | " is read from a 32-bit word and the IPMI data is in" | ||
| 70 | " bit 8-15, then the shift would be 8"); | ||
| 71 | module_param_hw_array(slave_addrs, int, other, &num_slave_addrs, 0); | 55 | module_param_hw_array(slave_addrs, int, other, &num_slave_addrs, 0); |
| 72 | MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for" | 56 | MODULE_PARM_DESC(slave_addrs, |
| 73 | " the controller. Normally this is 0x20, but can be" | 57 | "Set the default IPMB slave address for the controller. Normally this is 0x20, but can be overridden by this parm. This is an array indexed by interface number."); |
| 74 | " overridden by this parm. This is an array indexed" | ||
| 75 | " by interface number."); | ||
| 76 | 58 | ||
| 77 | static void __init ipmi_hardcode_init_one(const char *si_type_str, | 59 | static void __init ipmi_hardcode_init_one(const char *si_type_str, |
| 78 | unsigned int i, | 60 | unsigned int i, |
| @@ -80,26 +62,21 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str, · 1 unmodified line | |||
| 80 | enum ipmi_addr_space addr_space) | 62 | enum ipmi_addr_space addr_space) |
| 81 | { | 63 | { |
| 82 | struct ipmi_plat_data p; | 64 | struct ipmi_plat_data p; |
| 65 | int t; | ||
| 83 | 66 | ||
| 84 | memset(&p, 0, sizeof(p)); | 67 | memset(&p, 0, sizeof(p)); |
| 85 | 68 | ||
| 86 | p.iftype = IPMI_PLAT_IF_SI; | 69 | p.iftype = IPMI_PLAT_IF_SI; |
| 87 | if (!si_type_str || !*si_type_str || strcmp(si_type_str, "kcs") == 0) { | 70 | if (!si_type_str || !*si_type_str) { |
| 88 | p.type = SI_KCS; | 71 | p.type = SI_KCS; |
| 89 | } else if (strcmp(si_type_str, "smic") == 0) { | ||
| 90 | p.type = SI_SMIC; | ||
| 91 | } else if (strcmp(si_type_str, "bt") == 0) { | ||
| 92 | p.type = SI_BT; | ||
| 93 | } else if (strcmp(si_type_str, "invalid") == 0) { | ||
| 94 | /* | ||
| 95 | * Allow a firmware-specified interface to be | ||
| 96 | * disabled. | ||
| 97 | */ | ||
| 98 | p.type = SI_TYPE_INVALID; | ||
| 99 | } else { | 72 | } else { |
| 100 | pr_warn("Interface type specified for interface %d, was invalid: %s\n", | 73 | t = match_string(si_to_str, -1, si_type_str); |
| 101 | i, si_type_str); | 74 | if (t < 0) { |
| 102 | return; | 75 | pr_warn("Interface type specified for interface %d, was invalid: %s\n", |
| 76 | i, si_type_str); | ||
| 77 | return; | ||
| 78 | } | ||
| 79 | p.type = t; | ||
| 103 | } | 80 | } |
| 104 | 81 | ||
| 105 | p.regsize = regsizes[i]; | 82 | p.regsize = regsizes[i]; |
| @@ -17,9 +17,8 @@ · 16 unmodified lines | |||
| 17 | static int hotmod_handler(const char *val, const struct kernel_param *kp); | 17 | static int hotmod_handler(const char *val, const struct kernel_param *kp); |
| 18 | 18 | ||
| 19 | module_param_call(hotmod, hotmod_handler, NULL, NULL, 0200); | 19 | module_param_call(hotmod, hotmod_handler, NULL, NULL, 0200); |
| 20 | MODULE_PARM_DESC(hotmod, "Add and remove interfaces. See" | 20 | MODULE_PARM_DESC(hotmod, |
| 21 | " Documentation/driver-api/ipmi.rst in the kernel sources for the" | 21 | "Add and remove interfaces. See Documentation/driver-api/ipmi.rst in the kernel sources for the gory details."); |
| 22 | " gory details."); | ||
| 23 | 22 | ||
| 24 | /* | 23 | /* |
| 25 | * Parms come in as <op1>[:op2[:op3...]]. ops are: | 24 | * Parms come in as <op1>[:op2[:op3...]]. ops are: |
| @@ -185,24 +184,16 @@ static atomic_t hotmod_nr; · 159 unmodified lines | |||
| 185 | 184 | ||
| 186 | static int hotmod_handler(const char *val, const struct kernel_param *kp) | 185 | static int hotmod_handler(const char *val, const struct kernel_param *kp) |
| 187 | { | 186 | { |
| 188 | char *str = kstrdup(val, GFP_KERNEL), *curr, *next; | ||
| 189 | int rv; | 187 | int rv; |
| 190 | struct ipmi_plat_data h; | 188 | struct ipmi_plat_data h; |
| 191 | unsigned int len; | 189 | char *str, *curr, *next; |
| 192 | int ival; | ||
| 193 | 190 | ||
| 191 | str = kstrdup(val, GFP_KERNEL); | ||
| 194 | if (!str) | 192 | if (!str) |
| 195 | return -ENOMEM; | 193 | return -ENOMEM; |
| 196 | 194 | ||
| 197 | /* Kill any trailing spaces, as we can get a "\n" from echo. */ | 195 | /* Kill any trailing spaces, as we can get a "\n" from echo. */ |
| 198 | len = strlen(str); | 196 | for (curr = strstrip(str); curr; curr = next) { |
| 199 | ival = len - 1; | ||
| 200 | while ((ival >= 0) && isspace(str[ival])) { | ||
| 201 | str[ival] = '\0'; | ||
| 202 | ival--; | ||
| 203 | } | ||
| 204 | |||
| 205 | for (curr = str; curr; curr = next) { | ||
| 206 | enum hotmod_op op; | 197 | enum hotmod_op op; |
| 207 | 198 | ||
| 208 | next = strchr(curr, ':'); | 199 | next = strchr(curr, ':'); |
| @@ -231,11 +222,10 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp) · 22 unmodified lines | |||
| 231 | if (strcmp(pdev->name, "hotmod-ipmi-si") == 0) | 222 | if (strcmp(pdev->name, "hotmod-ipmi-si") == 0) |
| 232 | platform_device_unregister(pdev); | 223 | platform_device_unregister(pdev); |
| 233 | } | 224 | } |
| 234 | if (dev) | 225 | put_device(dev); |
| 235 | put_device(dev); | ||
| 236 | } | 226 | } |
| 237 | } | 227 | } |
| 238 | rv = len; | 228 | rv = strlen(val); |
| 239 | out: | 229 | out: |
| 240 | kfree(str); | 230 | kfree(str); |
| 241 | return rv; | 231 | return rv; |
| @@ -70,7 +70,8 @@ enum si_intf_state { · 69 unmodified lines | |||
| 70 | #define IPMI_BT_INTMASK_CLEAR_IRQ_BIT 2 | 70 | #define IPMI_BT_INTMASK_CLEAR_IRQ_BIT 2 |
| 71 | #define IPMI_BT_INTMASK_ENABLE_IRQ_BIT 1 | 71 | #define IPMI_BT_INTMASK_ENABLE_IRQ_BIT 1 |
| 72 | 72 | ||
| 73 | static const char * const si_to_str[] = { "invalid", "kcs", "smic", "bt" }; | 73 | /* 'invalid' to allow a firmware-specified interface to be disabled */ |
| 74 | const char *const si_to_str[] = { "invalid", "kcs", "smic", "bt", NULL }; | ||
| 74 | 75 | ||
| 75 | static bool initialized; | 76 | static bool initialized; |
| 76 | 77 | ||
| @@ -1169,9 +1170,8 @@ static int smi_start_processing(void *send_info, · 1092 unmodified lines | |||
| 1169 | new_smi->thread = kthread_run(ipmi_thread, new_smi, | 1170 | new_smi->thread = kthread_run(ipmi_thread, new_smi, |
| 1170 | "kipmi%d", new_smi->si_num); | 1171 | "kipmi%d", new_smi->si_num); |
| 1171 | if (IS_ERR(new_smi->thread)) { | 1172 | if (IS_ERR(new_smi->thread)) { |
| 1172 | dev_notice(new_smi->io.dev, "Could not start" | 1173 | dev_notice(new_smi->io.dev, |
| 1173 | " kernel thread due to error %ld, only using" | 1174 | "Could not start kernel thread due to error %ld, only using timers to drive the interface\n", |
| 1174 | " timers to drive the interface\n", | ||
| 1175 | PTR_ERR(new_smi->thread)); | 1175 | PTR_ERR(new_smi->thread)); |
| 1176 | new_smi->thread = NULL; | 1176 | new_smi->thread = NULL; |
| 1177 | } | 1177 | } |
| @@ -1223,18 +1223,14 @@ static int smi_num; /* Used to sequence the SMIs */ · 45 unmodified lines | |||
| 1223 | static const char * const addr_space_to_str[] = { "i/o", "mem" }; | 1223 | static const char * const addr_space_to_str[] = { "i/o", "mem" }; |
| 1224 | 1224 | ||
| 1225 | module_param_array(force_kipmid, int, &num_force_kipmid, 0); | 1225 | module_param_array(force_kipmid, int, &num_force_kipmid, 0); |
| 1226 | MODULE_PARM_DESC(force_kipmid, "Force the kipmi daemon to be enabled (1) or" | 1226 | MODULE_PARM_DESC(force_kipmid, |
| 1227 | " disabled(0). Normally the IPMI driver auto-detects" | 1227 | "Force the kipmi daemon to be enabled (1) or disabled(0). Normally the IPMI driver auto-detects this, but the value may be overridden by this parm."); |
| 1228 | " this, but the value may be overridden by this parm."); | ||
| 1229 | module_param(unload_when_empty, bool, 0); | 1228 | module_param(unload_when_empty, bool, 0); |
| 1230 | MODULE_PARM_DESC(unload_when_empty, "Unload the module if no interfaces are" | 1229 | MODULE_PARM_DESC(unload_when_empty, |
| 1231 | " specified or found, default is 1. Setting to 0" | 1230 | "Unload the module if no interfaces are specified or found, default is 1. Setting to 0 is useful for hot add of devices using hotmod."); |
| 1232 | " is useful for hot add of devices using hotmod."); | ||
| 1233 | module_param_array(kipmid_max_busy_us, uint, &num_max_busy_us, 0644); | 1231 | module_param_array(kipmid_max_busy_us, uint, &num_max_busy_us, 0644); |
| 1234 | MODULE_PARM_DESC(kipmid_max_busy_us, | 1232 | MODULE_PARM_DESC(kipmid_max_busy_us, |
| 1235 | "Max time (in microseconds) to busy-wait for IPMI data before" | 1233 | "Max time (in microseconds) to busy-wait for IPMI data before sleeping. 0 (default) means to wait forever. Set to 100-500 if kipmid is using up a lot of CPU time."); |
| 1236 | " sleeping. 0 (default) means to wait forever. Set to 100-500" | ||
| 1237 | " if kipmid is using up a lot of CPU time."); | ||
| 1238 | 1234 | ||
| 1239 | void ipmi_irq_finish_setup(struct si_sm_io *io) | 1235 | void ipmi_irq_finish_setup(struct si_sm_io *io) |
| 1240 | { | 1236 | { |
| @@ -1270,8 +1266,7 @@ int ipmi_std_irq_setup(struct si_sm_io *io) · 29 unmodified lines | |||
| 1270 | SI_DEVICE_NAME, | 1266 | SI_DEVICE_NAME, |
| 1271 | io->irq_handler_data); | 1267 | io->irq_handler_data); |
| 1272 | if (rv) { | 1268 | if (rv) { |
| 1273 | dev_warn(io->dev, "%s unable to claim interrupt %d," | 1269 | dev_warn(io->dev, "%s unable to claim interrupt %d, running polled\n", |
| 1274 | " running polled\n", | ||
| 1275 | SI_DEVICE_NAME, io->irq); | 1270 | SI_DEVICE_NAME, io->irq); |
| 1276 | io->irq = 0; | 1271 | io->irq = 0; |
| 1277 | } else { | 1272 | } else { |
| @@ -1346,10 +1341,8 @@ retry: · 68 unmodified lines | |||
| 1346 | /* record completion code */ | 1341 | /* record completion code */ |
| 1347 | unsigned char cc = *(resp + 2); | 1342 | unsigned char cc = *(resp + 2); |
| 1348 | 1343 | ||
| 1349 | if ((cc == IPMI_DEVICE_IN_FW_UPDATE_ERR | 1344 | if (cc != IPMI_CC_NO_ERROR && |
| 1350 | || cc == IPMI_DEVICE_IN_INIT_ERR | 1345 | ++retry_count <= GET_DEVICE_ID_MAX_RETRY) { |
| 1351 | || cc == IPMI_NOT_IN_MY_STATE_ERR) | ||
| 1352 | && ++retry_count <= GET_DEVICE_ID_MAX_RETRY) { | ||
| 1353 | dev_warn(smi_info->io.dev, | 1346 | dev_warn(smi_info->io.dev, |
| 1354 | "BMC returned 0x%2.2x, retry get bmc device id\n", | 1347 | "BMC returned 0x%2.2x, retry get bmc device id\n", |
| 1355 | cc); | 1348 | cc); |
| @@ -2207,10 +2200,6 @@ static void shutdown_smi(void *send_info) · 851 unmodified lines | |||
| 2207 | if (smi_info->handlers) | 2200 | if (smi_info->handlers) |
| 2208 | smi_info->handlers->cleanup(smi_info->si_sm); | 2201 | smi_info->handlers->cleanup(smi_info->si_sm); |
| 2209 | 2202 | ||
| 2210 | if (smi_info->io.addr_source_cleanup) { | ||
| 2211 | smi_info->io.addr_source_cleanup(&smi_info->io); | ||
| 2212 | smi_info->io.addr_source_cleanup = NULL; | ||
| 2213 | } | ||
| 2214 | if (smi_info->io.io_cleanup) { | 2203 | if (smi_info->io.io_cleanup) { |
| 2215 | smi_info->io.io_cleanup(&smi_info->io); | 2204 | smi_info->io.io_cleanup(&smi_info->io); |
| 2216 | smi_info->io.io_cleanup = NULL; | 2205 | smi_info->io.io_cleanup = NULL; |
| @@ -2306,5 +2295,4 @@ module_exit(cleanup_ipmi_si); · 89 unmodified lines | |||
| 2306 | MODULE_ALIAS("platform:dmi-ipmi-si"); | 2295 | MODULE_ALIAS("platform:dmi-ipmi-si"); |
| 2307 | MODULE_LICENSE("GPL"); | 2296 | MODULE_LICENSE("GPL"); |
| 2308 | MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); | 2297 | MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); |
| 2309 | MODULE_DESCRIPTION("Interface to the IPMI driver for the KCS, SMIC, and BT" | 2298 | MODULE_DESCRIPTION("Interface to the IPMI driver for the KCS, SMIC, and BT system interfaces."); |
| 2310 | " system interfaces."); | ||
| @@ -16,18 +16,11 @@ static bool pci_registered; · 15 unmodified lines | |||
| 16 | static bool si_trypci = true; | 16 | static bool si_trypci = true; |
| 17 | 17 | ||
| 18 | module_param_named(trypci, si_trypci, bool, 0); | 18 | module_param_named(trypci, si_trypci, bool, 0); |
| 19 | MODULE_PARM_DESC(trypci, "Setting this to zero will disable the" | 19 | MODULE_PARM_DESC(trypci, |
| 20 | " default scan of the interfaces identified via pci"); | 20 | "Setting this to zero will disable the default scan of the interfaces identified via pci"); |
| 21 | 21 | ||
| 22 | #define PCI_DEVICE_ID_HP_MMC 0x121A | 22 | #define PCI_DEVICE_ID_HP_MMC 0x121A |
| 23 | 23 | ||
| 24 | static void ipmi_pci_cleanup(struct si_sm_io *io) | ||
| 25 | { | ||
| 26 | struct pci_dev *pdev = io->addr_source_data; | ||
| 27 | |||
| 28 | pci_disable_device(pdev); | ||
| 29 | } | ||
| 30 | |||
| 31 | static int ipmi_pci_probe_regspacing(struct si_sm_io *io) | 24 | static int ipmi_pci_probe_regspacing(struct si_sm_io *io) |
| 32 | { | 25 | { |
| 33 | if (io->si_type == SI_KCS) { | 26 | if (io->si_type == SI_KCS) { |
| @@ -97,15 +90,12 @@ static int ipmi_pci_probe(struct pci_dev *pdev, · 63 unmodified lines | |||
| 97 | return -ENOMEM; | 90 | return -ENOMEM; |
| 98 | } | 91 | } |
| 99 | 92 | ||
| 100 | rv = pci_enable_device(pdev); | 93 | rv = pcim_enable_device(pdev); |
| 101 | if (rv) { | 94 | if (rv) { |
| 102 | dev_err(&pdev->dev, "couldn't enable PCI device\n"); | 95 | dev_err(&pdev->dev, "couldn't enable PCI device\n"); |
| 103 | return rv; | 96 | return rv; |
| 104 | } | 97 | } |
| 105 | 98 | ||
| 106 | io.addr_source_cleanup = ipmi_pci_cleanup; | ||
| 107 | io.addr_source_data = pdev; | ||
| 108 | |||
| 109 | if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) { | 99 | if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) { |
| 110 | io.addr_space = IPMI_IO_ADDR_SPACE; | 100 | io.addr_space = IPMI_IO_ADDR_SPACE; |
| 111 | io.io_setup = ipmi_si_port_setup; | 101 | io.io_setup = ipmi_si_port_setup; |
| @@ -128,11 +118,7 @@ static int ipmi_pci_probe(struct pci_dev *pdev, · 16 unmodified lines | |||
| 128 | dev_info(&pdev->dev, "%pR regsize %d spacing %d irq %d\n", | 118 | dev_info(&pdev->dev, "%pR regsize %d spacing %d irq %d\n", |
| 129 | &pdev->resource[0], io.regsize, io.regspacing, io.irq); | 119 | &pdev->resource[0], io.regsize, io.regspacing, io.irq); |
| 130 | 120 | ||
| 131 | rv = ipmi_si_add_smi(&io); | 121 | return ipmi_si_add_smi(&io); |
| 132 | if (rv) | ||
| 133 | pci_disable_device(pdev); | ||
| 134 | |||
| 135 | return rv; | ||
| 136 | } | 122 | } |
| 137 | 123 | ||
| 138 | static void ipmi_pci_remove(struct pci_dev *pdev) | 124 | static void ipmi_pci_remove(struct pci_dev *pdev) |
| @@ -34,23 +34,22 @@ static bool si_trydmi = false; · 33 unmodified lines | |||
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | module_param_named(tryplatform, si_tryplatform, bool, 0); | 36 | module_param_named(tryplatform, si_tryplatform, bool, 0); |
| 37 | MODULE_PARM_DESC(tryplatform, "Setting this to zero will disable the" | 37 | MODULE_PARM_DESC(tryplatform, |
| 38 | " default scan of the interfaces identified via platform" | 38 | "Setting this to zero will disable the default scan of the interfaces identified via platform interfaces besides ACPI, OpenFirmware, and DMI"); |
| 39 | " interfaces besides ACPI, OpenFirmware, and DMI"); | ||
| 40 | #ifdef CONFIG_ACPI | 39 | #ifdef CONFIG_ACPI |
| 41 | module_param_named(tryacpi, si_tryacpi, bool, 0); | 40 | module_param_named(tryacpi, si_tryacpi, bool, 0); |
| 42 | MODULE_PARM_DESC(tryacpi, "Setting this to zero will disable the" | 41 | MODULE_PARM_DESC(tryacpi, |
| 43 | " default scan of the interfaces identified via ACPI"); | 42 | "Setting this to zero will disable the default scan of the interfaces identified via ACPI"); |
| 44 | #endif | 43 | #endif |
| 45 | #ifdef CONFIG_OF | 44 | #ifdef CONFIG_OF |
| 46 | module_param_named(tryopenfirmware, si_tryopenfirmware, bool, 0); | 45 | module_param_named(tryopenfirmware, si_tryopenfirmware, bool, 0); |
| 47 | MODULE_PARM_DESC(tryopenfirmware, "Setting this to zero will disable the" | 46 | MODULE_PARM_DESC(tryopenfirmware, |
| 48 | " default scan of the interfaces identified via OpenFirmware"); | 47 | "Setting this to zero will disable the default scan of the interfaces identified via OpenFirmware"); |
| 49 | #endif | 48 | #endif |
| 50 | #ifdef CONFIG_DMI | 49 | #ifdef CONFIG_DMI |
| 51 | module_param_named(trydmi, si_trydmi, bool, 0); | 50 | module_param_named(trydmi, si_trydmi, bool, 0); |
| 52 | MODULE_PARM_DESC(trydmi, "Setting this to zero will disable the" | 51 | MODULE_PARM_DESC(trydmi, |
| 53 | " default scan of the interfaces identified via DMI"); | 52 | "Setting this to zero will disable the default scan of the interfaces identified via DMI"); |
| 54 | #endif | 53 | #endif |
| 55 | 54 | ||
| 56 | #ifdef CONFIG_ACPI | 55 | #ifdef CONFIG_ACPI |
| @@ -85,47 +84,46 @@ static int acpi_gpe_irq_setup(struct si_sm_io *io) · 28 unmodified lines | |||
| 85 | ACPI_GPE_LEVEL_TRIGGERED, | 84 | ACPI_GPE_LEVEL_TRIGGERED, |
| 86 | &ipmi_acpi_gpe, | 85 | &ipmi_acpi_gpe, |
| 87 | io); | 86 | io); |
| 88 | if (status != AE_OK) { | 87 | if (ACPI_FAILURE(status)) { |
| 89 | dev_warn(io->dev, | 88 | dev_warn(io->dev, |
| 90 | "Unable to claim ACPI GPE %d, running polled\n", | 89 | "Unable to claim ACPI GPE %d, running polled\n", |
| 91 | io->irq); | 90 | io->irq); |
| 92 | io->irq = 0; | 91 | io->irq = 0; |
| 93 | return -EINVAL; | 92 | return -EINVAL; |
| 94 | } else { | ||
| 95 | io->irq_cleanup = acpi_gpe_irq_cleanup; | ||
| 96 | ipmi_irq_finish_setup(io); | ||
| 97 | dev_info(io->dev, "Using ACPI GPE %d\n", io->irq); | ||
| 98 | return 0; | ||
| 99 | } | 93 | } |
| 94 | |||
| 95 | io->irq_cleanup = acpi_gpe_irq_cleanup; | ||
| 96 | ipmi_irq_finish_setup(io); | ||
| 97 | dev_info(io->dev, "Using ACPI GPE %d\n", io->irq); | ||
| 98 | return 0; | ||
| 100 | } | 99 | } |
| 101 | #endif | 100 | #endif |
| 102 | 101 | ||
| 102 | static void ipmi_set_addr_data_and_space(struct resource *r, struct si_sm_io *io) | ||
| 103 | { | ||
| 104 | if (resource_type(r) == IORESOURCE_IO) | ||
| 105 | io->addr_space = IPMI_IO_ADDR_SPACE; | ||
| 106 | else | ||
| 107 | io->addr_space = IPMI_MEM_ADDR_SPACE; | ||
| 108 | io->addr_data = r->start; | ||
| 109 | } | ||
| 110 | |||
| 103 | static struct resource * | 111 | static struct resource * |
| 104 | ipmi_get_info_from_resources(struct platform_device *pdev, | 112 | ipmi_get_info_from_resources(struct platform_device *pdev, |
| 105 | struct si_sm_io *io) | 113 | struct si_sm_io *io) |
| 106 | { | 114 | { |
| 107 | struct resource *res, *res_second; | 115 | struct resource *res, *res_second; |
| 108 | 116 | ||
| 109 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 117 | res = platform_get_mem_or_io(pdev, 0); |
| 110 | if (res) { | ||
| 111 | io->addr_space = IPMI_IO_ADDR_SPACE; | ||
| 112 | } else { | ||
| 113 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 114 | if (res) | ||
| 115 | io->addr_space = IPMI_MEM_ADDR_SPACE; | ||
| 116 | } | ||
| 117 | if (!res) { | 118 | if (!res) { |
| 118 | dev_err(&pdev->dev, "no I/O or memory address\n"); | 119 | dev_err(&pdev->dev, "no I/O or memory address\n"); |
| 119 | return NULL; | 120 | return NULL; |
| 120 | } | 121 | } |
| 121 | io->addr_data = res->start; | 122 | ipmi_set_addr_data_and_space(res, io); |
| 122 | 123 | ||
| 123 | io->regspacing = DEFAULT_REGSPACING; | 124 | io->regspacing = DEFAULT_REGSPACING; |
| 124 | res_second = platform_get_resource(pdev, | 125 | res_second = platform_get_mem_or_io(pdev, 1); |
| 125 | (io->addr_space == IPMI_IO_ADDR_SPACE) ? | 126 | if (res_second && resource_type(res_second) == resource_type(res)) { |
| 126 | IORESOURCE_IO : IORESOURCE_MEM, | ||
| 127 | 1); | ||
| 128 | if (res_second) { | ||
| 129 | if (res_second->start > io->addr_data) | 127 | if (res_second->start > io->addr_data) |
| 130 | io->regspacing = res_second->start - io->addr_data; | 128 | io->regspacing = res_second->start - io->addr_data; |
| 131 | } | 129 | } |
| @@ -275,12 +273,7 @@ static int of_ipmi_probe(struct platform_device *pdev) · 143 unmodified lines | |||
| 275 | io.addr_source = SI_DEVICETREE; | 273 | io.addr_source = SI_DEVICETREE; |
| 276 | io.irq_setup = ipmi_std_irq_setup; | 274 | io.irq_setup = ipmi_std_irq_setup; |
| 277 | 275 | ||
| 278 | if (resource.flags & IORESOURCE_IO) | 276 | ipmi_set_addr_data_and_space(&resource, &io); |
| 279 | io.addr_space = IPMI_IO_ADDR_SPACE; | ||
| 280 | else | ||
| 281 | io.addr_space = IPMI_MEM_ADDR_SPACE; | ||
| 282 | |||
| 283 | io.addr_data = resource.start; | ||
| 284 | 277 | ||
| 285 | io.regsize = regsize ? be32_to_cpup(regsize) : DEFAULT_REGSIZE; | 278 | io.regsize = regsize ? be32_to_cpup(regsize) : DEFAULT_REGSIZE; |
| 286 | io.regspacing = regspacing ? be32_to_cpup(regspacing) : DEFAULT_REGSPACING; | 279 | io.regspacing = regspacing ? be32_to_cpup(regspacing) : DEFAULT_REGSPACING; |
| @@ -317,32 +310,31 @@ static int find_slave_address(struct si_sm_io *io, int slave_addr) · 30 unmodified lines | |||
| 317 | 310 | ||
| 318 | static int acpi_ipmi_probe(struct platform_device *pdev) | 311 | static int acpi_ipmi_probe(struct platform_device *pdev) |
| 319 | { | 312 | { |
| 313 | struct device *dev = &pdev->dev; | ||
| 320 | struct si_sm_io io; | 314 | struct si_sm_io io; |
| 321 | acpi_handle handle; | 315 | acpi_handle handle; |
| 322 | acpi_status status; | 316 | acpi_status status; |
| 323 | unsigned long long tmp; | 317 | unsigned long long tmp; |
| 324 | struct resource *res; | 318 | struct resource *res; |
| 325 | int rv = -EINVAL; | ||
| 326 | 319 | ||
| 327 | if (!si_tryacpi) | 320 | if (!si_tryacpi) |
| 328 | return -ENODEV; | 321 | return -ENODEV; |
| 329 | 322 | ||
| 330 | handle = ACPI_HANDLE(&pdev->dev); | 323 | handle = ACPI_HANDLE(dev); |
| 331 | if (!handle) | 324 | if (!handle) |
| 332 | return -ENODEV; | 325 | return -ENODEV; |
| 333 | 326 | ||
| 334 | memset(&io, 0, sizeof(io)); | 327 | memset(&io, 0, sizeof(io)); |
| 335 | io.addr_source = SI_ACPI; | 328 | io.addr_source = SI_ACPI; |
| 336 | dev_info(&pdev->dev, "probing via ACPI\n"); | 329 | dev_info(dev, "probing via ACPI\n"); |
| 337 | 330 | ||
| 338 | io.addr_info.acpi_info.acpi_handle = handle; | 331 | io.addr_info.acpi_info.acpi_handle = handle; |
| 339 | 332 | ||
| 340 | /* _IFT tells us the interface type: KCS, BT, etc */ | 333 | /* _IFT tells us the interface type: KCS, BT, etc */ |
| 341 | status = acpi_evaluate_integer(handle, "_IFT", NULL, &tmp); | 334 | status = acpi_evaluate_integer(handle, "_IFT", NULL, &tmp); |
| 342 | if (ACPI_FAILURE(status)) { | 335 | if (ACPI_FAILURE(status)) { |
| 343 | dev_err(&pdev->dev, | 336 | dev_err(dev, "Could not find ACPI IPMI interface type\n"); |
| 344 | "Could not find ACPI IPMI interface type\n"); | 337 | return -EINVAL; |
| 345 | goto err_free; | ||
| 346 | } | 338 | } |
| 347 | 339 | ||
| 348 | switch (tmp) { | 340 | switch (tmp) { |
| @@ -356,21 +348,19 @@ static int acpi_ipmi_probe(struct platform_device *pdev) · 7 unmodified lines | |||
| 356 | io.si_type = SI_BT; | 348 | io.si_type = SI_BT; |
| 357 | break; | 349 | break; |
| 358 | case 4: /* SSIF, just ignore */ | 350 | case 4: /* SSIF, just ignore */ |
| 359 | rv = -ENODEV; | 351 | return -ENODEV; |
| 360 | goto err_free; | ||
| 361 | default: | 352 | default: |
| 362 | dev_info(&pdev->dev, "unknown IPMI type %lld\n", tmp); | 353 | dev_info(dev, "unknown IPMI type %lld\n", tmp); |
| 363 | goto err_free; | 354 | return -EINVAL; |
| 364 | } | 355 | } |
| 365 | 356 | ||
| 357 | io.dev = dev; | ||
| 366 | io.regsize = DEFAULT_REGSIZE; | 358 | io.regsize = DEFAULT_REGSIZE; |
| 367 | io.regshift = 0; | 359 | io.regshift = 0; |
| 368 | 360 | ||
| 369 | res = ipmi_get_info_from_resources(pdev, &io); | 361 | res = ipmi_get_info_from_resources(pdev, &io); |
| 370 | if (!res) { | 362 | if (!res) |
| 371 | rv = -EINVAL; | 363 | return -EINVAL; |
| 372 | goto err_free; | ||
| 373 | } | ||
| 374 | 364 | ||
| 375 | /* If _GPE exists, use it; otherwise use standard interrupts */ | 365 | /* If _GPE exists, use it; otherwise use standard interrupts */ |
| 376 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); | 366 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); |
| @@ -388,17 +378,12 @@ static int acpi_ipmi_probe(struct platform_device *pdev) · 11 unmodified lines | |||
| 388 | 378 | ||
| 389 | io.slave_addr = find_slave_address(&io, io.slave_addr); | 379 | io.slave_addr = find_slave_address(&io, io.slave_addr); |
| 390 | 380 | ||
| 391 | io.dev = &pdev->dev; | 381 | dev_info(dev, "%pR regsize %d spacing %d irq %d\n", |
| 392 | |||
| 393 | dev_info(io.dev, "%pR regsize %d spacing %d irq %d\n", | ||
| 394 | res, io.regsize, io.regspacing, io.irq); | 382 | res, io.regsize, io.regspacing, io.irq); |
| 395 | 383 | ||
| 396 | request_module("acpi_ipmi"); | 384 | request_module("acpi_ipmi"); |
| 397 | 385 | ||
| 398 | return ipmi_si_add_smi(&io); | 386 | return ipmi_si_add_smi(&io); |
| 399 | |||
| 400 | err_free: | ||
| 401 | return rv; | ||
| 402 | } | 387 | } |
| 403 | 388 | ||
| 404 | static const struct acpi_device_id acpi_ipmi_match[] = { | 389 | static const struct acpi_device_id acpi_ipmi_match[] = { |
| @@ -510,7 +510,7 @@ static int ipmi_ssif_thread(void *data) · 509 unmodified lines | |||
| 510 | return 0; | 510 | return 0; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | static int ssif_i2c_send(struct ssif_info *ssif_info, | 513 | static void ssif_i2c_send(struct ssif_info *ssif_info, |
| 514 | ssif_i2c_done handler, | 514 | ssif_i2c_done handler, |
| 515 | int read_write, int command, | 515 | int read_write, int command, |
| 516 | unsigned char *data, unsigned int size) | 516 | unsigned char *data, unsigned int size) |
| @@ -522,7 +522,6 @@ static int ssif_i2c_send(struct ssif_info *ssif_info, · 5 unmodified lines | |||
| 522 | ssif_info->i2c_data = data; | 522 | ssif_info->i2c_data = data; |
| 523 | ssif_info->i2c_size = size; | 523 | ssif_info->i2c_size = size; |
| 524 | complete(&ssif_info->wake_thread); | 524 | complete(&ssif_info->wake_thread); |
| 525 | return 0; | ||
| 526 | } | 525 | } |
| 527 | 526 | ||
| 528 | 527 | ||
| @@ -531,22 +530,12 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 2 unmodified lines | |||
| 531 | 530 | ||
| 532 | static void start_get(struct ssif_info *ssif_info) | 531 | static void start_get(struct ssif_info *ssif_info) |
| 533 | { | 532 | { |
| 534 | int rv; | ||
| 535 | |||
| 536 | ssif_info->rtc_us_timer = 0; | 533 | ssif_info->rtc_us_timer = 0; |
| 537 | ssif_info->multi_pos = 0; | 534 | ssif_info->multi_pos = 0; |
| 538 | 535 | ||
| 539 | rv = ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ, | 536 | ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ, |
| 540 | SSIF_IPMI_RESPONSE, | 537 | SSIF_IPMI_RESPONSE, |
| 541 | ssif_info->recv, I2C_SMBUS_BLOCK_DATA); | 538 | ssif_info->recv, I2C_SMBUS_BLOCK_DATA); |
| 542 | if (rv < 0) { | ||
| 543 | /* request failed, just return the error. */ | ||
| 544 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | ||
| 545 | dev_dbg(&ssif_info->client->dev, | ||
| 546 | "Error from i2c_non_blocking_op(5)\n"); | ||
| 547 | |||
| 548 | msg_done_handler(ssif_info, -EIO, NULL, 0); | ||
| 549 | } | ||
| 550 | } | 539 | } |
| 551 | 540 | ||
| 552 | static void retry_timeout(struct timer_list *t) | 541 | static void retry_timeout(struct timer_list *t) |
| @@ -620,7 +609,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 67 unmodified lines | |||
| 620 | { | 609 | { |
| 621 | struct ipmi_smi_msg *msg; | 610 | struct ipmi_smi_msg *msg; |
| 622 | unsigned long oflags, *flags; | 611 | unsigned long oflags, *flags; |
| 623 | int rv; | ||
| 624 | 612 | ||
| 625 | /* | 613 | /* |
| 626 | * We are single-threaded here, so no need for a lock until we | 614 | * We are single-threaded here, so no need for a lock until we |
| @@ -666,17 +654,10 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 39 unmodified lines | |||
| 666 | ssif_info->multi_len = len; | 654 | ssif_info->multi_len = len; |
| 667 | ssif_info->multi_pos = 1; | 655 | ssif_info->multi_pos = 1; |
| 668 | 656 | ||
| 669 | rv = ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ, | 657 | ssif_i2c_send(ssif_info, msg_done_handler, I2C_SMBUS_READ, |
| 670 | SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE, | 658 | SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE, |
| 671 | ssif_info->recv, I2C_SMBUS_BLOCK_DATA); | 659 | ssif_info->recv, I2C_SMBUS_BLOCK_DATA); |
| 672 | if (rv < 0) { | 660 | return; |
| 673 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | ||
| 674 | dev_dbg(&ssif_info->client->dev, | ||
| 675 | "Error from i2c_non_blocking_op(1)\n"); | ||
| 676 | |||
| 677 | result = -EIO; | ||
| 678 | } else | ||
| 679 | return; | ||
| 680 | } else if (ssif_info->multi_pos) { | 661 | } else if (ssif_info->multi_pos) { |
| 681 | /* Middle of multi-part read. Start the next transaction. */ | 662 | /* Middle of multi-part read. Start the next transaction. */ |
| 682 | int i; | 663 | int i; |
| @@ -738,19 +719,12 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 55 unmodified lines | |||
| 738 | 719 | ||
| 739 | ssif_info->multi_pos++; | 720 | ssif_info->multi_pos++; |
| 740 | 721 | ||
| 741 | rv = ssif_i2c_send(ssif_info, msg_done_handler, | 722 | ssif_i2c_send(ssif_info, msg_done_handler, |
| 742 | I2C_SMBUS_READ, | 723 | I2C_SMBUS_READ, |
| 743 | SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE, | 724 | SSIF_IPMI_MULTI_PART_RESPONSE_MIDDLE, |
| 744 | ssif_info->recv, | 725 | ssif_info->recv, |
| 745 | I2C_SMBUS_BLOCK_DATA); | 726 | I2C_SMBUS_BLOCK_DATA); |
| 746 | if (rv < 0) { | 727 | return; |
| 747 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | ||
| 748 | dev_dbg(&ssif_info->client->dev, | ||
| 749 | "Error from ssif_i2c_send\n"); | ||
| 750 | |||
| 751 | result = -EIO; | ||
| 752 | } else | ||
| 753 | return; | ||
| 754 | } | 728 | } |
| 755 | } | 729 | } |
| 756 | 730 | ||
| @@ -908,8 +882,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 151 unmodified lines | |||
| 908 | static void msg_written_handler(struct ssif_info *ssif_info, int result, | 882 | static void msg_written_handler(struct ssif_info *ssif_info, int result, |
| 909 | unsigned char *data, unsigned int len) | 883 | unsigned char *data, unsigned int len) |
| 910 | { | 884 | { |
| 911 | int rv; | ||
| 912 | |||
| 913 | /* We are single-threaded here, so no need for a lock. */ | 885 | /* We are single-threaded here, so no need for a lock. */ |
| 914 | if (result < 0) { | 886 | if (result < 0) { |
| 915 | ssif_info->retries_left--; | 887 | ssif_info->retries_left--; |
| @@ -972,18 +944,9 @@ static void msg_written_handler(struct ssif_info *ssif_info, int result, · 56 unmodified lines | |||
| 972 | ssif_info->multi_data = NULL; | 944 | ssif_info->multi_data = NULL; |
| 973 | } | 945 | } |
| 974 | 946 | ||
| 975 | rv = ssif_i2c_send(ssif_info, msg_written_handler, | 947 | ssif_i2c_send(ssif_info, msg_written_handler, |
| 976 | I2C_SMBUS_WRITE, cmd, | 948 | I2C_SMBUS_WRITE, cmd, |
| 977 | data_to_send, I2C_SMBUS_BLOCK_DATA); | 949 | data_to_send, I2C_SMBUS_BLOCK_DATA); |
| 978 | if (rv < 0) { | ||
| 979 | /* request failed, just return the error. */ | ||
| 980 | ssif_inc_stat(ssif_info, send_errors); | ||
| 981 | |||
| 982 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | ||
| 983 | dev_dbg(&ssif_info->client->dev, | ||
| 984 | "Error from i2c_non_blocking_op(3)\n"); | ||
| 985 | msg_done_handler(ssif_info, -EIO, NULL, 0); | ||
| 986 | } | ||
| 987 | } else { | 950 | } else { |
| 988 | /* Ready to request the result. */ | 951 | /* Ready to request the result. */ |
| 989 | unsigned long oflags, *flags; | 952 | unsigned long oflags, *flags; |
| @@ -1012,7 +975,6 @@ static void msg_written_handler(struct ssif_info *ssif_info, int result, · 22 unmodified lines | |||
| 1012 | 975 | ||
| 1013 | static int start_resend(struct ssif_info *ssif_info) | 976 | static int start_resend(struct ssif_info *ssif_info) |
| 1014 | { | 977 | { |
| 1015 | int rv; | ||
| 1016 | int command; | 978 | int command; |
| 1017 | 979 | ||
| 1018 | ssif_info->got_alert = false; | 980 | ssif_info->got_alert = false; |
| @@ -1034,12 +996,9 @@ static int start_resend(struct ssif_info *ssif_info) · 15 unmodified lines | |||
| 1034 | ssif_info->data[0] = ssif_info->data_len; | 996 | ssif_info->data[0] = ssif_info->data_len; |
| 1035 | } | 997 | } |
| 1036 | 998 | ||
| 1037 | rv = ssif_i2c_send(ssif_info, msg_written_handler, I2C_SMBUS_WRITE, | 999 | ssif_i2c_send(ssif_info, msg_written_handler, I2C_SMBUS_WRITE, |
| 1038 | command, ssif_info->data, I2C_SMBUS_BLOCK_DATA); | 1000 | command, ssif_info->data, I2C_SMBUS_BLOCK_DATA); |
| 1039 | if (rv && (ssif_info->ssif_debug & SSIF_DEBUG_MSG)) | 1001 | return 0; |
| 1040 | dev_dbg(&ssif_info->client->dev, | ||
| 1041 | "Error from i2c_non_blocking_op(4)\n"); | ||
| 1042 | return rv; | ||
| 1043 | } | 1002 | } |
| 1044 | 1003 | ||
| 1045 | static int start_send(struct ssif_info *ssif_info, | 1004 | static int start_send(struct ssif_info *ssif_info, |