aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2017-09-01 11:43:49 -0400
committerCorey Minyard <cminyard@mvista.com>2017-09-27 17:03:45 -0400
commitf33e4df83e00f629aece2bd3a8d22b533e9d7877 (patch)
treea49f70c9e34e5dd504a720b7b6454c744e5b158c
parent72630d9a01c8ba56c55671a1b103aa5e2df57408 (diff)
ipmi: Move bmc find routing to below bmc device type
No functional change, this is for a later change that uses the bmc device type. Signed-off-by: Corey Minyard <cminyard@mvista.com>
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c101
1 files changed, 51 insertions, 50 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index dbf8c6ac8c73..5780fdf6bc7a 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2276,56 +2276,6 @@ static void remove_proc_entries(ipmi_smi_t smi)
2276#endif /* CONFIG_PROC_FS */ 2276#endif /* CONFIG_PROC_FS */
2277} 2277}
2278 2278
2279static int __find_bmc_guid(struct device *dev, void *data)
2280{
2281 unsigned char *id = data;
2282 struct bmc_device *bmc = to_bmc_device(dev);
2283 return memcmp(bmc->guid, id, 16) == 0;
2284}
2285
2286static struct bmc_device *ipmi_find_bmc_guid(struct device_driver *drv,
2287 unsigned char *guid)
2288{
2289 struct device *dev;
2290
2291 dev = driver_find_device(drv, NULL, guid, __find_bmc_guid);
2292 if (dev)
2293 return to_bmc_device(dev);
2294 else
2295 return NULL;
2296}
2297
2298struct prod_dev_id {
2299 unsigned int product_id;
2300 unsigned char device_id;
2301};
2302
2303static int __find_bmc_prod_dev_id(struct device *dev, void *data)
2304{
2305 struct prod_dev_id *id = data;
2306 struct bmc_device *bmc = to_bmc_device(dev);
2307
2308 return (bmc->id.product_id == id->product_id
2309 && bmc->id.device_id == id->device_id);
2310}
2311
2312static struct bmc_device *ipmi_find_bmc_prod_dev_id(
2313 struct device_driver *drv,
2314 unsigned int product_id, unsigned char device_id)
2315{
2316 struct prod_dev_id id = {
2317 .product_id = product_id,
2318 .device_id = device_id,
2319 };
2320 struct device *dev;
2321
2322 dev = driver_find_device(drv, NULL, &id, __find_bmc_prod_dev_id);
2323 if (dev)
2324 return to_bmc_device(dev);
2325 else
2326 return NULL;
2327}
2328
2329static ssize_t device_id_show(struct device *dev, 2279static ssize_t device_id_show(struct device *dev,
2330 struct device_attribute *attr, 2280 struct device_attribute *attr,
2331 char *buf) 2281 char *buf)
@@ -2480,6 +2430,57 @@ static const struct device_type bmc_device_type = {
2480 .groups = bmc_dev_attr_groups, 2430 .groups = bmc_dev_attr_groups,
2481}; 2431};
2482 2432
2433static int __find_bmc_guid(struct device *dev, void *data)
2434{
2435 unsigned char *id = data;
2436 struct bmc_device *bmc = to_bmc_device(dev);
2437
2438 return memcmp(bmc->guid, id, 16) == 0;
2439}
2440
2441static struct bmc_device *ipmi_find_bmc_guid(struct device_driver *drv,
2442 unsigned char *guid)
2443{
2444 struct device *dev;
2445
2446 dev = driver_find_device(drv, NULL, guid, __find_bmc_guid);
2447 if (dev)
2448 return to_bmc_device(dev);
2449 else
2450 return NULL;
2451}
2452
2453struct prod_dev_id {
2454 unsigned int product_id;
2455 unsigned char device_id;
2456};
2457
2458static int __find_bmc_prod_dev_id(struct device *dev, void *data)
2459{
2460 struct prod_dev_id *id = data;
2461 struct bmc_device *bmc = to_bmc_device(dev);
2462
2463 return (bmc->id.product_id == id->product_id
2464 && bmc->id.device_id == id->device_id);
2465}
2466
2467static struct bmc_device *ipmi_find_bmc_prod_dev_id(
2468 struct device_driver *drv,
2469 unsigned int product_id, unsigned char device_id)
2470{
2471 struct prod_dev_id id = {
2472 .product_id = product_id,
2473 .device_id = device_id,
2474 };
2475 struct device *dev;
2476
2477 dev = driver_find_device(drv, NULL, &id, __find_bmc_prod_dev_id);
2478 if (dev)
2479 return to_bmc_device(dev);
2480 else
2481 return NULL;
2482}
2483
2483static void 2484static void
2484release_bmc_device(struct device *dev) 2485release_bmc_device(struct device *dev)
2485{ 2486{