Commit 85c1a254 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-5.2' of git://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "Some minor cleanups for the IPMI driver"

* tag 'for-linus-5.2' of git://github.com/cminyard/linux-ipmi:
  ipmi: Remove warning if no slave address is present
  ipmi:ssif: Only unregister the platform driver if it was registered
  ipmi:ssif: compare block number correctly for multi-part return messages
  ipmi: Add the i2c-addr property for SSIF interfaces
  char/ipmi: fix spelling mistake "receieved_messages" -> "received_messages"
  ipmi: avoid atomic_inc in exit function
  ipmi: Remove file from ipmi_file_private
  ipmi_si: remove an unused variable in try_smi_init()
  ipmi: Make ipmi_interfaces_srcu variable static
parents fe460a6d ed6c3a6d
...@@ -212,7 +212,7 @@ Description: ...@@ -212,7 +212,7 @@ Description:
Messages may be broken into parts if Messages may be broken into parts if
they are long. they are long.
receieved_messages: (RO) Number of message responses received_messages: (RO) Number of message responses
received. received.
received_message_parts: (RO) Number of message fragments received_message_parts: (RO) Number of message fragments
......
...@@ -29,7 +29,6 @@ struct ipmi_file_private ...@@ -29,7 +29,6 @@ struct ipmi_file_private
struct ipmi_user *user; struct ipmi_user *user;
spinlock_t recv_msg_lock; spinlock_t recv_msg_lock;
struct list_head recv_msgs; struct list_head recv_msgs;
struct file *file;
struct fasync_struct *fasync_queue; struct fasync_struct *fasync_queue;
wait_queue_head_t wait; wait_queue_head_t wait;
struct mutex recv_mutex; struct mutex recv_mutex;
...@@ -95,8 +94,6 @@ static int ipmi_open(struct inode *inode, struct file *file) ...@@ -95,8 +94,6 @@ static int ipmi_open(struct inode *inode, struct file *file)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->file = file;
rv = ipmi_create_user(if_num, rv = ipmi_create_user(if_num,
&ipmi_hndlrs, &ipmi_hndlrs,
priv, priv,
......
...@@ -47,9 +47,11 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, ...@@ -47,9 +47,11 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr,
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
name = "dmi-ipmi-si"; name = "dmi-ipmi-si";
p.iftype = IPMI_PLAT_IF_SI;
switch (type) { switch (type) {
case IPMI_DMI_TYPE_SSIF: case IPMI_DMI_TYPE_SSIF:
name = "dmi-ipmi-ssif"; name = "dmi-ipmi-ssif";
p.iftype = IPMI_PLAT_IF_SSIF;
p.type = SI_TYPE_INVALID; p.type = SI_TYPE_INVALID;
break; break;
case IPMI_DMI_TYPE_BT: case IPMI_DMI_TYPE_BT:
......
...@@ -635,7 +635,7 @@ static DEFINE_MUTEX(ipmidriver_mutex); ...@@ -635,7 +635,7 @@ static DEFINE_MUTEX(ipmidriver_mutex);
static LIST_HEAD(ipmi_interfaces); static LIST_HEAD(ipmi_interfaces);
static DEFINE_MUTEX(ipmi_interfaces_mutex); static DEFINE_MUTEX(ipmi_interfaces_mutex);
struct srcu_struct ipmi_interfaces_srcu; static struct srcu_struct ipmi_interfaces_srcu;
/* /*
* List of watchers that want to know when smi's are added and deleted. * List of watchers that want to know when smi's are added and deleted.
...@@ -5179,7 +5179,7 @@ static void __exit cleanup_ipmi(void) ...@@ -5179,7 +5179,7 @@ static void __exit cleanup_ipmi(void)
* avoids problems with race conditions removing the timer * avoids problems with race conditions removing the timer
* here. * here.
*/ */
atomic_inc(&stop_operation); atomic_set(&stop_operation, 1);
del_timer_sync(&ipmi_timer); del_timer_sync(&ipmi_timer);
initialized = false; initialized = false;
......
...@@ -12,7 +12,7 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst, ...@@ -12,7 +12,7 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
struct ipmi_plat_data *p) struct ipmi_plat_data *p)
{ {
struct platform_device *pdev; struct platform_device *pdev;
unsigned int num_r = 1, size, pidx = 0; unsigned int num_r = 1, size = 0, pidx = 0;
struct resource r[4]; struct resource r[4];
struct property_entry pr[6]; struct property_entry pr[6];
u32 flags; u32 flags;
...@@ -21,19 +21,22 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst, ...@@ -21,19 +21,22 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
memset(pr, 0, sizeof(pr)); memset(pr, 0, sizeof(pr));
memset(r, 0, sizeof(r)); memset(r, 0, sizeof(r));
if (p->type == SI_BT) if (p->iftype == IPMI_PLAT_IF_SI) {
size = 3; if (p->type == SI_BT)
else if (p->type == SI_TYPE_INVALID) size = 3;
size = 0; else if (p->type != SI_TYPE_INVALID)
else size = 2;
size = 2;
if (p->regsize == 0)
p->regsize = DEFAULT_REGSIZE;
if (p->regspacing == 0)
p->regspacing = p->regsize;
if (p->regsize == 0) pr[pidx++] = PROPERTY_ENTRY_U8("ipmi-type", p->type);
p->regsize = DEFAULT_REGSIZE; } else if (p->iftype == IPMI_PLAT_IF_SSIF) {
if (p->regspacing == 0) pr[pidx++] = PROPERTY_ENTRY_U16("i2c-addr", p->addr);
p->regspacing = p->regsize; }
pr[pidx++] = PROPERTY_ENTRY_U8("ipmi-type", p->type);
if (p->slave_addr) if (p->slave_addr)
pr[pidx++] = PROPERTY_ENTRY_U8("slave-addr", p->slave_addr); pr[pidx++] = PROPERTY_ENTRY_U8("slave-addr", p->slave_addr);
pr[pidx++] = PROPERTY_ENTRY_U8("addr-source", p->addr_source); pr[pidx++] = PROPERTY_ENTRY_U8("addr-source", p->addr_source);
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
#include <linux/ipmi.h> #include <linux/ipmi.h>
enum ipmi_plat_interface_type { IPMI_PLAT_IF_SI, IPMI_PLAT_IF_SSIF };
struct ipmi_plat_data { struct ipmi_plat_data {
enum ipmi_plat_interface_type iftype;
unsigned int type; /* si_type for si, SI_INVALID for others */ unsigned int type; /* si_type for si, SI_INVALID for others */
unsigned int space; /* addr_space for si, intf# for ssif. */ unsigned int space; /* addr_space for si, intf# for ssif. */
unsigned long addr; unsigned long addr;
......
...@@ -83,6 +83,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str, ...@@ -83,6 +83,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str,
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
p.iftype = IPMI_PLAT_IF_SI;
if (!si_type_str || !*si_type_str || strcmp(si_type_str, "kcs") == 0) { if (!si_type_str || !*si_type_str || strcmp(si_type_str, "kcs") == 0) {
p.type = SI_KCS; p.type = SI_KCS;
} else if (strcmp(si_type_str, "smic") == 0) { } else if (strcmp(si_type_str, "smic") == 0) {
......
...@@ -108,6 +108,7 @@ static int parse_hotmod_str(const char *curr, enum hotmod_op *op, ...@@ -108,6 +108,7 @@ static int parse_hotmod_str(const char *curr, enum hotmod_op *op,
int rv; int rv;
unsigned int ival; unsigned int ival;
h->iftype = IPMI_PLAT_IF_SI;
rv = parse_str(hotmod_ops, &ival, "operation", &curr); rv = parse_str(hotmod_ops, &ival, "operation", &curr);
if (rv) if (rv)
return rv; return rv;
......
...@@ -1931,7 +1931,6 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -1931,7 +1931,6 @@ static int try_smi_init(struct smi_info *new_smi)
{ {
int rv = 0; int rv = 0;
int i; int i;
char *init_name = NULL;
pr_info("Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n", pr_info("Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n",
ipmi_addr_src_to_str(new_smi->io.addr_source), ipmi_addr_src_to_str(new_smi->io.addr_source),
...@@ -2073,7 +2072,6 @@ static int try_smi_init(struct smi_info *new_smi) ...@@ -2073,7 +2072,6 @@ static int try_smi_init(struct smi_info *new_smi)
new_smi->io.io_cleanup = NULL; new_smi->io.io_cleanup = NULL;
} }
kfree(init_name);
return rv; return rv;
} }
......
...@@ -188,12 +188,10 @@ static int platform_ipmi_probe(struct platform_device *pdev) ...@@ -188,12 +188,10 @@ static int platform_ipmi_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr); rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr);
if (rv) { if (rv)
dev_warn(&pdev->dev, "device has no slave-addr property\n");
io.slave_addr = 0x20; io.slave_addr = 0x20;
} else { else
io.slave_addr = slave_addr; io.slave_addr = slave_addr;
}
io.irq = platform_get_irq(pdev, 0); io.irq = platform_get_irq(pdev, 0);
if (io.irq > 0) if (io.irq > 0)
......
...@@ -727,12 +727,16 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, ...@@ -727,12 +727,16 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
/* End of read */ /* End of read */
len = ssif_info->multi_len; len = ssif_info->multi_len;
data = ssif_info->data; data = ssif_info->data;
} else if (blocknum != ssif_info->multi_pos) { } else if (blocknum + 1 != ssif_info->multi_pos) {
/* /*
* Out of sequence block, just abort. Block * Out of sequence block, just abort. Block
* numbers start at zero for the second block, * numbers start at zero for the second block,
* but multi_pos starts at one, so the +1. * but multi_pos starts at one, so the +1.
*/ */
if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
dev_dbg(&ssif_info->client->dev,
"Received message out of sequence, expected %u, got %u\n",
ssif_info->multi_pos - 1, blocknum);
result = -EIO; result = -EIO;
} else { } else {
ssif_inc_stat(ssif_info, received_message_parts); ssif_inc_stat(ssif_info, received_message_parts);
...@@ -1991,7 +1995,7 @@ static int dmi_ipmi_probe(struct platform_device *pdev) ...@@ -1991,7 +1995,7 @@ static int dmi_ipmi_probe(struct platform_device *pdev)
rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr); rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr);
if (rv) if (rv)
dev_warn(&pdev->dev, "device has no slave-addr property"); slave_addr = 0x20;
return new_ssif_client(i2c_addr, NULL, 0, return new_ssif_client(i2c_addr, NULL, 0,
slave_addr, SI_SMBIOS, &pdev->dev); slave_addr, SI_SMBIOS, &pdev->dev);
...@@ -2107,7 +2111,8 @@ static void cleanup_ipmi_ssif(void) ...@@ -2107,7 +2111,8 @@ static void cleanup_ipmi_ssif(void)
kfree(ssif_i2c_driver.address_list); kfree(ssif_i2c_driver.address_list);
platform_driver_unregister(&ipmi_driver); if (ssif_trydmi)
platform_driver_unregister(&ipmi_driver);
free_ssif_clients(); free_ssif_clients();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment