]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ipmi_si: Rename addr_type to addr_space to match what it does
authorCorey Minyard <cminyard@mvista.com>
Thu, 21 Feb 2019 18:53:00 +0000 (12:53 -0600)
committerCorey Minyard <cminyard@mvista.com>
Fri, 22 Feb 2019 13:12:41 +0000 (07:12 -0600)
Make the naming consistent, and make the values an enum.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
drivers/char/ipmi/ipmi_si.h
drivers/char/ipmi/ipmi_si_hardcode.c
drivers/char/ipmi/ipmi_si_hotmod.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/ipmi/ipmi_si_parisc.c
drivers/char/ipmi/ipmi_si_pci.c
drivers/char/ipmi/ipmi_si_platform.c
drivers/char/ipmi/ipmi_si_sm.h

index 7ae52c17618ed754d1ddf244fd791833a053738b..3efc8a71aab4ec59fbd17af19547cdc5720c542a 100644 (file)
@@ -9,9 +9,6 @@
 #include <linux/interrupt.h>
 #include "ipmi_si_sm.h"
 
-#define IPMI_IO_ADDR_SPACE  0
-#define IPMI_MEM_ADDR_SPACE 1
-
 #define DEFAULT_REGSPACING     1
 #define DEFAULT_REGSIZE                1
 
@@ -27,7 +24,7 @@ void ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
                            unsigned long addr);
 void ipmi_hardcode_init(void);
 void ipmi_si_hardcode_exit(void);
-int ipmi_si_hardcode_match(int addr_type, unsigned long addr);
+int ipmi_si_hardcode_match(int addr_space, unsigned long addr);
 void ipmi_si_platform_init(void);
 void ipmi_si_platform_shutdown(void);
 
index 1e5783961b0dca31f9b99416bf0a7a7fef1aa70c..86ac9b8a3219af54810874d30d299ac660b0b070 100644 (file)
@@ -240,11 +240,11 @@ void ipmi_si_hardcode_exit(void)
  * Returns true of the given address exists as a hardcoded address,
  * false if not.
  */
-int ipmi_si_hardcode_match(int addr_type, unsigned long addr)
+int ipmi_si_hardcode_match(int addr_space, unsigned long addr)
 {
        unsigned int i;
 
-       if (addr_type == IPMI_IO_ADDR_SPACE) {
+       if (addr_space == IPMI_IO_ADDR_SPACE) {
                for (i = 0; i < num_ports; i++) {
                        if (ports[i] == addr)
                                return 1;
index c0067fd0480dfda8337d58d32640207ff0bef266..f3d455bbf3ccdfaface913f93e1e6ac55df10e8e 100644 (file)
@@ -106,7 +106,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
        char *next, *curr, *s, *n, *o;
        enum hotmod_op op;
        enum si_type si_type;
-       int  addr_space;
+       enum ipmi_addr_space addr_space;
        unsigned long addr;
        int regspacing;
        int regsize;
@@ -150,9 +150,10 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
                        break;
                si_type = ival;
 
-               rv = parse_str(hotmod_as, &addr_space, "address space", &curr);
+               rv = parse_str(hotmod_as, &ival, "address space", &curr);
                if (rv)
                        break;
+               addr_space = ival;
 
                s = strchr(curr, ',');
                if (s) {
@@ -215,7 +216,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
                        io.addr_source = SI_HOTMOD;
                        io.si_type = si_type;
                        io.addr_data = addr;
-                       io.addr_type = addr_space;
+                       io.addr_space = addr_space;
 
                        io.addr = NULL;
                        io.regspacing = regspacing;
index abbd526626d516c0dc3fe0c08f57044b74d92ccc..54e3b4f2c02485f7561942caa65452342c457628 100644 (file)
@@ -1645,7 +1645,7 @@ static ssize_t ipmi_params_show(struct device *dev,
        return snprintf(buf, 200,
                        "%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n",
                        si_to_str[smi_info->io.si_type],
-                       addr_space_to_str[smi_info->io.addr_type],
+                       addr_space_to_str[smi_info->io.addr_space],
                        smi_info->io.addr_data,
                        smi_info->io.regspacing,
                        smi_info->io.regsize,
@@ -1843,7 +1843,7 @@ static struct smi_info *find_dup_si(struct smi_info *info)
        struct smi_info *e;
 
        list_for_each_entry(e, &smi_infos, link) {
-               if (e->io.addr_type != info->io.addr_type)
+               if (e->io.addr_space != info->io.addr_space)
                        continue;
                if (e->io.addr_data == info->io.addr_data) {
                        /*
@@ -1871,16 +1871,16 @@ int ipmi_si_add_smi(struct si_sm_io *io)
         * in the firmware.
         */
        if (io->addr_source != SI_HARDCODED &&
-           ipmi_si_hardcode_match(io->addr_type, io->addr_data)) {
+           ipmi_si_hardcode_match(io->addr_space, io->addr_data)) {
                dev_info(io->dev,
                         "Hard-coded device at this address already exists");
                return -ENODEV;
        }
 
        if (!io->io_setup) {
-               if (io->addr_type == IPMI_IO_ADDR_SPACE) {
+               if (io->addr_space == IPMI_IO_ADDR_SPACE) {
                        io->io_setup = ipmi_si_port_setup;
-               } else if (io->addr_type == IPMI_MEM_ADDR_SPACE) {
+               } else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
                        io->io_setup = ipmi_si_mem_setup;
                } else {
                        return -EINVAL;
@@ -1942,7 +1942,7 @@ static int try_smi_init(struct smi_info *new_smi)
        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),
                si_to_str[new_smi->io.si_type],
-               addr_space_to_str[new_smi->io.addr_type],
+               addr_space_to_str[new_smi->io.addr_space],
                new_smi->io.addr_data,
                new_smi->io.slave_addr, new_smi->io.irq);
 
@@ -2289,7 +2289,7 @@ void ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
 
        mutex_lock(&smi_infos_lock);
        list_for_each_entry_safe(e, tmp_e, &smi_infos, link) {
-               if (e->io.addr_type != addr_space)
+               if (e->io.addr_space != addr_space)
                        continue;
                if (e->io.si_type != si_type)
                        continue;
index f3c99820f564ed4c5e9c3090555fb32ca6d4a439..11c9160275dfe320f890a7e7d0efbc284f7deb3c 100644 (file)
@@ -15,7 +15,7 @@ static int __init ipmi_parisc_probe(struct parisc_device *dev)
 
        io.si_type      = SI_KCS;
        io.addr_source  = SI_DEVICETREE;
-       io.addr_type    = IPMI_MEM_ADDR_SPACE;
+       io.addr_space   = IPMI_MEM_ADDR_SPACE;
        io.addr_data    = dev->hpa.start;
        io.regsize      = 1;
        io.regspacing   = 1;
index ce00c0da58665886be9554aac8deec33fcf0f62c..ce93fc7a1e36b0619774cee10934b61e9a9fce44 100644 (file)
@@ -107,10 +107,10 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
        io.addr_source_data = pdev;
 
        if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
-               io.addr_type = IPMI_IO_ADDR_SPACE;
+               io.addr_space = IPMI_IO_ADDR_SPACE;
                io.io_setup = ipmi_si_port_setup;
        } else {
-               io.addr_type = IPMI_MEM_ADDR_SPACE;
+               io.addr_space = IPMI_MEM_ADDR_SPACE;
                io.io_setup = ipmi_si_mem_setup;
        }
        io.addr_data = pci_resource_start(pdev, 0);
index 8158d03542f4bb1643a248ce7f53992b7fe1830f..f690e9edb08c1aec97daf64f92ef4424c1010bc9 100644 (file)
@@ -107,11 +107,11 @@ ipmi_get_info_from_resources(struct platform_device *pdev,
 
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
        if (res) {
-               io->addr_type = IPMI_IO_ADDR_SPACE;
+               io->addr_space = IPMI_IO_ADDR_SPACE;
        } else {
                res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
                if (res)
-                       io->addr_type = IPMI_MEM_ADDR_SPACE;
+                       io->addr_space = IPMI_MEM_ADDR_SPACE;
        }
        if (!res) {
                dev_err(&pdev->dev, "no I/O or memory address\n");
@@ -121,7 +121,7 @@ ipmi_get_info_from_resources(struct platform_device *pdev,
 
        io->regspacing = DEFAULT_REGSPACING;
        res_second = platform_get_resource(pdev,
-                              (io->addr_type == IPMI_IO_ADDR_SPACE) ?
+                              (io->addr_space == IPMI_IO_ADDR_SPACE) ?
                                        IORESOURCE_IO : IORESOURCE_MEM,
                               1);
        if (res_second) {
@@ -205,7 +205,7 @@ static int platform_ipmi_probe(struct platform_device *pdev)
 
        pr_info("ipmi_si: %s: %s %#lx regsize %d spacing %d irq %d\n",
                ipmi_addr_src_to_str(addr_source),
-               (io.addr_type == IPMI_IO_ADDR_SPACE) ? "io" : "mem",
+               (io.addr_space == IPMI_IO_ADDR_SPACE) ? "io" : "mem",
                io.addr_data, io.regsize, io.regspacing, io.irq);
 
        ipmi_si_add_smi(&io);
@@ -277,9 +277,9 @@ static int of_ipmi_probe(struct platform_device *pdev)
        io.irq_setup    = ipmi_std_irq_setup;
 
        if (resource.flags & IORESOURCE_IO)
-               io.addr_type = IPMI_IO_ADDR_SPACE;
+               io.addr_space = IPMI_IO_ADDR_SPACE;
        else
-               io.addr_type = IPMI_MEM_ADDR_SPACE;
+               io.addr_space = IPMI_MEM_ADDR_SPACE;
 
        io.addr_data    = resource.start;
 
@@ -310,7 +310,7 @@ static int find_slave_address(struct si_sm_io *io, int slave_addr)
        if (!slave_addr) {
                u32 flags = IORESOURCE_IO;
 
-               if (io->addr_type == IPMI_MEM_ADDR_SPACE)
+               if (io->addr_space == IPMI_MEM_ADDR_SPACE)
                        flags = IORESOURCE_MEM;
 
                slave_addr = ipmi_dmi_get_slave_addr(io->si_type, flags,
index 41aaa555d5660954eb963b5db02ff1583efe93f2..499db820fadb3a0aea90afaa85d34b1d328f4fcb 100644 (file)
@@ -26,6 +26,10 @@ enum si_type {
        SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT
 };
 
+enum ipmi_addr_space {
+       IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE
+};
+
 /*
  * The structure for doing I/O in the state machine.  The state
  * machine doesn't have the actual I/O routines, they are done through
@@ -45,7 +49,7 @@ struct si_sm_io {
        unsigned int regspacing;
        unsigned int regsize;
        unsigned int regshift;
-       int addr_type;
+       enum ipmi_addr_space addr_space;
        unsigned long addr_data;
        enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
        void (*addr_source_cleanup)(struct si_sm_io *io);