Commit 98df67b3 authored by Kay Sievers's avatar Kay Sievers Committed by Martin Schwidefsky

[S390] struct device - replace bus_id with dev_name(), dev_set_name()

Acked-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 0cd4bd47
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
/* This is ugly... */ /* This is ugly... */
#define PRINTK_HEADER "dasd_devmap:" #define PRINTK_HEADER "dasd_devmap:"
#define DASD_BUS_ID_SIZE 20
#include "dasd_int.h" #include "dasd_int.h"
...@@ -41,7 +42,7 @@ EXPORT_SYMBOL_GPL(dasd_page_cache); ...@@ -41,7 +42,7 @@ EXPORT_SYMBOL_GPL(dasd_page_cache);
*/ */
struct dasd_devmap { struct dasd_devmap {
struct list_head list; struct list_head list;
char bus_id[BUS_ID_SIZE]; char bus_id[DASD_BUS_ID_SIZE];
unsigned int devindex; unsigned int devindex;
unsigned short features; unsigned short features;
struct dasd_device *device; struct dasd_device *device;
...@@ -94,7 +95,7 @@ dasd_hash_busid(const char *bus_id) ...@@ -94,7 +95,7 @@ dasd_hash_busid(const char *bus_id)
int hash, i; int hash, i;
hash = 0; hash = 0;
for (i = 0; (i < BUS_ID_SIZE) && *bus_id; i++, bus_id++) for (i = 0; (i < DASD_BUS_ID_SIZE) && *bus_id; i++, bus_id++)
hash += *bus_id; hash += *bus_id;
return hash & 0xff; return hash & 0xff;
} }
...@@ -301,7 +302,7 @@ dasd_parse_range( char *parsestring ) { ...@@ -301,7 +302,7 @@ dasd_parse_range( char *parsestring ) {
int from, from_id0, from_id1; int from, from_id0, from_id1;
int to, to_id0, to_id1; int to, to_id0, to_id1;
int features, rc; int features, rc;
char bus_id[BUS_ID_SIZE+1], *str; char bus_id[DASD_BUS_ID_SIZE+1], *str;
str = parsestring; str = parsestring;
rc = dasd_busid(&str, &from_id0, &from_id1, &from); rc = dasd_busid(&str, &from_id0, &from_id1, &from);
...@@ -407,14 +408,14 @@ dasd_add_busid(const char *bus_id, int features) ...@@ -407,14 +408,14 @@ dasd_add_busid(const char *bus_id, int features)
devmap = NULL; devmap = NULL;
hash = dasd_hash_busid(bus_id); hash = dasd_hash_busid(bus_id);
list_for_each_entry(tmp, &dasd_hashlists[hash], list) list_for_each_entry(tmp, &dasd_hashlists[hash], list)
if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) { if (strncmp(tmp->bus_id, bus_id, DASD_BUS_ID_SIZE) == 0) {
devmap = tmp; devmap = tmp;
break; break;
} }
if (!devmap) { if (!devmap) {
/* This bus_id is new. */ /* This bus_id is new. */
new->devindex = dasd_max_devindex++; new->devindex = dasd_max_devindex++;
strncpy(new->bus_id, bus_id, BUS_ID_SIZE); strncpy(new->bus_id, bus_id, DASD_BUS_ID_SIZE);
new->features = features; new->features = features;
new->device = NULL; new->device = NULL;
list_add(&new->list, &dasd_hashlists[hash]); list_add(&new->list, &dasd_hashlists[hash]);
...@@ -439,7 +440,7 @@ dasd_find_busid(const char *bus_id) ...@@ -439,7 +440,7 @@ dasd_find_busid(const char *bus_id)
devmap = ERR_PTR(-ENODEV); devmap = ERR_PTR(-ENODEV);
hash = dasd_hash_busid(bus_id); hash = dasd_hash_busid(bus_id);
list_for_each_entry(tmp, &dasd_hashlists[hash], list) { list_for_each_entry(tmp, &dasd_hashlists[hash], list) {
if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) { if (strncmp(tmp->bus_id, bus_id, DASD_BUS_ID_SIZE) == 0) {
devmap = tmp; devmap = tmp;
break; break;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define DCSSBLK_NAME "dcssblk" #define DCSSBLK_NAME "dcssblk"
#define DCSSBLK_MINORS_PER_DISK 1 #define DCSSBLK_MINORS_PER_DISK 1
#define DCSSBLK_PARM_LEN 400 #define DCSSBLK_PARM_LEN 400
#define DCSS_BUS_ID_SIZE 20
#ifdef DCSSBLK_DEBUG #ifdef DCSSBLK_DEBUG
#define PRINT_DEBUG(x...) printk(KERN_DEBUG DCSSBLK_NAME " debug: " x) #define PRINT_DEBUG(x...) printk(KERN_DEBUG DCSSBLK_NAME " debug: " x)
...@@ -50,7 +51,7 @@ static struct block_device_operations dcssblk_devops = { ...@@ -50,7 +51,7 @@ static struct block_device_operations dcssblk_devops = {
struct dcssblk_dev_info { struct dcssblk_dev_info {
struct list_head lh; struct list_head lh;
struct device dev; struct device dev;
char segment_name[BUS_ID_SIZE]; char segment_name[DCSS_BUS_ID_SIZE];
atomic_t use_count; atomic_t use_count;
struct gendisk *gd; struct gendisk *gd;
unsigned long start; unsigned long start;
...@@ -65,7 +66,7 @@ struct dcssblk_dev_info { ...@@ -65,7 +66,7 @@ struct dcssblk_dev_info {
struct segment_info { struct segment_info {
struct list_head lh; struct list_head lh;
char segment_name[BUS_ID_SIZE]; char segment_name[DCSS_BUS_ID_SIZE];
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
int segment_type; int segment_type;
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/ccwgroup.h> #include <asm/ccwgroup.h>
#define CCW_BUS_ID_SIZE 20
/* In Linux 2.4, we had a channel device layer called "chandev" /* In Linux 2.4, we had a channel device layer called "chandev"
* that did all sorts of obscure stuff for networking devices. * that did all sorts of obscure stuff for networking devices.
* This is another driver that serves as a replacement for just * This is another driver that serves as a replacement for just
...@@ -172,7 +174,7 @@ static int __get_next_bus_id(const char **buf, char *bus_id) ...@@ -172,7 +174,7 @@ static int __get_next_bus_id(const char **buf, char *bus_id)
len = end - start + 1; len = end - start + 1;
end++; end++;
} }
if (len < BUS_ID_SIZE) { if (len < CCW_BUS_ID_SIZE) {
strlcpy(bus_id, start, len); strlcpy(bus_id, start, len);
rc = 0; rc = 0;
} else } else
...@@ -181,7 +183,7 @@ static int __get_next_bus_id(const char **buf, char *bus_id) ...@@ -181,7 +183,7 @@ static int __get_next_bus_id(const char **buf, char *bus_id)
return rc; return rc;
} }
static int __is_valid_bus_id(char bus_id[BUS_ID_SIZE]) static int __is_valid_bus_id(char bus_id[CCW_BUS_ID_SIZE])
{ {
int cssid, ssid, devno; int cssid, ssid, devno;
...@@ -213,7 +215,7 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, ...@@ -213,7 +215,7 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
{ {
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
int rc, i; int rc, i;
char tmp_bus_id[BUS_ID_SIZE]; char tmp_bus_id[CCW_BUS_ID_SIZE];
const char *curr_buf; const char *curr_buf;
gdev = kzalloc(sizeof(*gdev) + num_devices * sizeof(gdev->cdev[0]), gdev = kzalloc(sizeof(*gdev) + num_devices * sizeof(gdev->cdev[0]),
......
...@@ -1723,7 +1723,7 @@ __ccwdev_check_busid(struct device *dev, void *id) ...@@ -1723,7 +1723,7 @@ __ccwdev_check_busid(struct device *dev, void *id)
bus_id = id; bus_id = id;
return (strncmp(bus_id, dev_name(dev), BUS_ID_SIZE) == 0); return (strcmp(bus_id, dev_name(dev)) == 0);
} }
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include "zfcp_ext.h" #include "zfcp_ext.h"
#define ZFCP_BUS_ID_SIZE 20
static char *device; static char *device;
MODULE_AUTHOR("IBM Deutschland Entwicklung GmbH - linux390@de.ibm.com"); MODULE_AUTHOR("IBM Deutschland Entwicklung GmbH - linux390@de.ibm.com");
...@@ -84,9 +86,9 @@ static int __init zfcp_device_setup(char *devstr) ...@@ -84,9 +86,9 @@ static int __init zfcp_device_setup(char *devstr)
strcpy(str, devstr); strcpy(str, devstr);
token = strsep(&str, ","); token = strsep(&str, ",");
if (!token || strlen(token) >= BUS_ID_SIZE) if (!token || strlen(token) >= ZFCP_BUS_ID_SIZE)
goto err_out; goto err_out;
strncpy(zfcp_data.init_busid, token, BUS_ID_SIZE); strncpy(zfcp_data.init_busid, token, ZFCP_BUS_ID_SIZE);
token = strsep(&str, ","); token = strsep(&str, ",");
if (!token || strict_strtoull(token, 0, if (!token || strict_strtoull(token, 0,
......
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