Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d2940fb6
Commit
d2940fb6
authored
Feb 06, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] IBM PCI Hotplug driver: Clean up the slot filename generation logic a lot.
parent
a0347d12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
71 deletions
+6
-71
drivers/hotplug/ibmphp_ebda.c
drivers/hotplug/ibmphp_ebda.c
+6
-71
No files found.
drivers/hotplug/ibmphp_ebda.c
View file @
d2940fb6
...
...
@@ -65,8 +65,6 @@ static LIST_HEAD (opt_vg_head);
static
LIST_HEAD
(
opt_lo_head
);
static
void
*
io_mem
;
char
*
chassis_str
,
*
rxe_str
,
*
str
;
/* Local functions */
static
int
ebda_rsrc_controller
(
void
);
static
int
ebda_rsrc_rsrc
(
void
);
...
...
@@ -591,32 +589,6 @@ static int combine_wpg_for_expansion (void)
return
0
;
}
static
char
*
convert_2digits_to_char
(
int
var
)
{
int
bit
;
char
*
str1
;
str
=
(
char
*
)
kmalloc
(
3
,
GFP_KERNEL
);
memset
(
str
,
0
,
3
);
str1
=
(
char
*
)
kmalloc
(
2
,
GFP_KERNEL
);
memset
(
str
,
0
,
3
);
bit
=
(
int
)(
var
/
10
);
switch
(
bit
)
{
case
0
:
//one digit number
*
str
=
(
char
)(
var
+
48
);
return
str
;
default:
//2 digits number
*
str1
=
(
char
)(
bit
+
48
);
strncpy
(
str
,
str1
,
1
);
memset
(
str1
,
0
,
3
);
*
str1
=
(
char
)((
var
%
10
)
+
48
);
strcat
(
str
,
str1
);
return
str
;
}
return
NULL
;
}
/* Since we don't know the max slot number per each chassis, hence go
* through the list of all chassis to find out the range
...
...
@@ -701,7 +673,7 @@ static char *create_file_name (struct slot * slot_cur)
{
struct
opt_rio
*
opt_vg_ptr
=
NULL
;
struct
opt_rio_lo
*
opt_lo_ptr
=
NULL
;
char
*
ptr_chassis_num
,
*
ptr_rxe_num
,
*
ptr_slot_num
;
static
char
str
[
30
]
;
int
which
=
0
;
/* rxe = 1, chassis = 0 */
u8
number
=
1
;
/* either chassis or rxe # */
u8
first_slot
=
1
;
...
...
@@ -715,19 +687,7 @@ static char *create_file_name (struct slot * slot_cur)
slot_num
=
slot_cur
->
number
;
chassis_str
=
(
char
*
)
kmalloc
(
30
,
GFP_KERNEL
);
memset
(
chassis_str
,
0
,
30
);
rxe_str
=
(
char
*
)
kmalloc
(
30
,
GFP_KERNEL
);
memset
(
rxe_str
,
0
,
30
);
ptr_chassis_num
=
(
char
*
)
kmalloc
(
3
,
GFP_KERNEL
);
memset
(
ptr_chassis_num
,
0
,
3
);
ptr_rxe_num
=
(
char
*
)
kmalloc
(
3
,
GFP_KERNEL
);
memset
(
ptr_rxe_num
,
0
,
3
);
ptr_slot_num
=
(
char
*
)
kmalloc
(
3
,
GFP_KERNEL
);
memset
(
ptr_slot_num
,
0
,
3
);
strcpy
(
chassis_str
,
"chassis"
);
strcpy
(
rxe_str
,
"rxe"
);
memset
(
str
,
0
,
sizeof
(
str
));
if
(
rio_table_ptr
)
{
if
(
rio_table_ptr
->
ver_num
==
3
)
{
...
...
@@ -772,31 +732,10 @@ static char *create_file_name (struct slot * slot_cur)
}
}
switch
(
which
)
{
case
0
:
/* Chassis */
*
ptr_chassis_num
=
(
char
)(
number
+
48
);
strcat
(
chassis_str
,
ptr_chassis_num
);
kfree
(
ptr_chassis_num
);
strcat
(
chassis_str
,
"slot"
);
ptr_slot_num
=
convert_2digits_to_char
(
slot_num
-
first_slot
+
1
);
strcat
(
chassis_str
,
ptr_slot_num
);
kfree
(
ptr_slot_num
);
return
chassis_str
;
break
;
case
1
:
/* RXE */
*
ptr_rxe_num
=
(
char
)(
number
+
48
);
strcat
(
rxe_str
,
ptr_rxe_num
);
kfree
(
ptr_rxe_num
);
strcat
(
rxe_str
,
"slot"
);
ptr_slot_num
=
convert_2digits_to_char
(
slot_num
-
first_slot
+
1
);
strcat
(
rxe_str
,
ptr_slot_num
);
kfree
(
ptr_slot_num
);
return
rxe_str
;
break
;
}
return
NULL
;
sprintf
(
str
,
"%s%dslot%d"
,
which
==
0
?
"chassis"
:
"rxe"
,
number
,
slot_num
-
first_slot
+
1
);
return
str
;
}
static
struct
pci_driver
ibmphp_driver
;
...
...
@@ -1060,10 +999,6 @@ static int __init ebda_rsrc_controller (void)
slot_cur
=
list_entry
(
list
,
struct
slot
,
ibm_slot_list
);
snprintf
(
slot_cur
->
hotplug_slot
->
name
,
30
,
"%s"
,
create_file_name
(
slot_cur
));
if
(
chassis_str
)
kfree
(
chassis_str
);
if
(
rxe_str
)
kfree
(
rxe_str
);
pci_hp_register
(
slot_cur
->
hotplug_slot
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment