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
e3f4c34c
Commit
e3f4c34c
authored
Sep 25, 2003
by
Martin Schwidefsky
Committed by
Linus Torvalds
Sep 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] s390: sysfs_create_group.
Make use of sysfs_create_group in s390 device drivers.
parent
b18c1e47
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
157 additions
and
154 deletions
+157
-154
drivers/s390/block/dasd.c
drivers/s390/block/dasd.c
+13
-11
drivers/s390/cio/device.c
drivers/s390/cio/device.c
+34
-16
drivers/s390/net/ctcmain.c
drivers/s390/net/ctcmain.c
+11
-4
drivers/s390/net/lcs.c
drivers/s390/net/lcs.c
+11
-1
drivers/s390/net/netiucv.c
drivers/s390/net/netiucv.c
+42
-20
drivers/s390/net/qeth.c
drivers/s390/net/qeth.c
+46
-102
No files found.
drivers/s390/block/dasd.c
View file @
e3f4c34c
...
@@ -1996,20 +1996,22 @@ dasd_discipline_show(struct device *dev, char *buf)
...
@@ -1996,20 +1996,22 @@ dasd_discipline_show(struct device *dev, char *buf)
static
DEVICE_ATTR
(
discipline
,
0444
,
dasd_discipline_show
,
NULL
);
static
DEVICE_ATTR
(
discipline
,
0444
,
dasd_discipline_show
,
NULL
);
static
struct
attribute
*
dasd_attrs
[]
=
{
//&dev_attr_dasd.attr,
&
dev_attr_readonly
.
attr
,
&
dev_attr_discipline
.
attr
,
&
dev_attr_use_diag
.
attr
,
NULL
,
};
static
struct
attribute_group
dasd_attr_group
=
{
.
attrs
=
dasd_attrs
,
};
static
int
static
int
dasd_add_sysfs_files
(
struct
ccw_device
*
cdev
)
dasd_add_sysfs_files
(
struct
ccw_device
*
cdev
)
{
{
int
ret
;
return
sysfs_create_group
(
&
cdev
->
dev
.
kobj
,
&
dasd_attr_group
);
if
(
/* (ret = device_create_file(&cdev->dev, &dev_attr_dasd)) || */
(
ret
=
device_create_file
(
&
cdev
->
dev
,
&
dev_attr_readonly
))
||
(
ret
=
device_create_file
(
&
cdev
->
dev
,
&
dev_attr_discipline
))
||
(
ret
=
device_create_file
(
&
cdev
->
dev
,
&
dev_attr_use_diag
)))
{
device_remove_file
(
&
cdev
->
dev
,
&
dev_attr_discipline
);
device_remove_file
(
&
cdev
->
dev
,
&
dev_attr_readonly
);
/* device_remove_file(&cdev->dev, &dev_attr_dasd); */
}
return
ret
;
}
}
static
int
__init
static
int
__init
...
...
drivers/s390/cio/device.c
View file @
e3f4c34c
...
@@ -373,30 +373,43 @@ ccw_device_unbox_recog(void *data)
...
@@ -373,30 +373,43 @@ ccw_device_unbox_recog(void *data)
spin_unlock_irq
(
cdev
->
ccwlock
);
spin_unlock_irq
(
cdev
->
ccwlock
);
}
}
static
struct
attribute
*
subch_attrs
[]
=
{
&
dev_attr_chpids
.
attr
,
&
dev_attr_pimpampom
.
attr
,
NULL
,
};
static
struct
attribute_group
subch_attr_group
=
{
.
attrs
=
subch_attrs
,
};
static
inline
int
static
inline
int
subchannel_add_files
(
struct
device
*
dev
)
subchannel_add_files
(
struct
device
*
dev
)
{
{
int
ret
;
return
sysfs_create_group
(
&
dev
->
kobj
,
&
subch_attr_group
);
if
((
ret
=
device_create_file
(
dev
,
&
dev_attr_chpids
))
||
(
ret
=
device_create_file
(
dev
,
&
dev_attr_pimpampom
)))
{
device_remove_file
(
dev
,
&
dev_attr_chpids
);
}
return
ret
;
}
}
static
struct
attribute
*
ccwdev_attrs
[]
=
{
&
dev_attr_devtype
.
attr
,
&
dev_attr_cutype
.
attr
,
&
dev_attr_online
.
attr
,
NULL
,
};
static
struct
attribute_group
ccwdev_attr_group
=
{
.
attrs
=
ccwdev_attrs
,
};
static
inline
int
static
inline
int
device_add_files
(
struct
device
*
dev
)
device_add_files
(
struct
device
*
dev
)
{
{
int
ret
;
return
sysfs_create_group
(
&
dev
->
kobj
,
&
ccwdev_attr_group
);
}
if
((
ret
=
device_create_file
(
dev
,
&
dev_attr_devtype
))
||
static
inline
void
(
ret
=
device_create_file
(
dev
,
&
dev_attr_cutype
))
||
device_remove_files
(
struct
device
*
dev
)
(
ret
=
device_create_file
(
dev
,
&
dev_attr_online
)))
{
{
device_remove_file
(
dev
,
&
dev_attr_cutype
);
sysfs_remove_group
(
&
dev
->
kobj
,
&
ccwdev_attr_group
);
device_remove_file
(
dev
,
&
dev_attr_devtype
);
}
return
ret
;
}
}
/*
/*
...
@@ -437,7 +450,12 @@ ccw_device_register(struct ccw_device *cdev)
...
@@ -437,7 +450,12 @@ ccw_device_register(struct ccw_device *cdev)
void
void
ccw_device_unregister
(
void
*
data
)
ccw_device_unregister
(
void
*
data
)
{
{
device_unregister
((
struct
device
*
)
data
);
struct
device
*
dev
;
dev
=
(
struct
device
*
)
data
;
device_remove_files
(
dev
);
device_unregister
(
dev
);
}
}
...
...
drivers/s390/net/ctcmain.c
View file @
e3f4c34c
...
@@ -2786,18 +2786,25 @@ ctc_proto_store(struct device *dev, const char *buf, size_t count)
...
@@ -2786,18 +2786,25 @@ ctc_proto_store(struct device *dev, const char *buf, size_t count)
static
DEVICE_ATTR
(
protocol
,
0644
,
ctc_proto_show
,
ctc_proto_store
);
static
DEVICE_ATTR
(
protocol
,
0644
,
ctc_proto_show
,
ctc_proto_store
);
static
struct
attribute
*
ctc_attr
[]
=
{
&
dev_attr_protocol
.
attr
,
NULL
,
};
static
struct
attribute_group
ctc_attr_group
=
{
.
attrs
=
ctc_attr
,
};
static
int
static
int
ctc_add_files
(
struct
device
*
dev
)
ctc_add_files
(
struct
device
*
dev
)
{
{
return
device_create_file
(
dev
,
&
dev_attr_protocol
);
return
sysfs_create_group
(
&
dev
->
kobj
,
&
ctc_attr_group
);
}
}
static
void
static
void
ctc_remove_files
(
struct
device
*
dev
)
ctc_remove_files
(
struct
device
*
dev
)
{
{
device_remove_file
(
dev
,
&
dev_attr_protocol
);
sysfs_remove_group
(
&
dev
->
kobj
,
&
ctc_attr_group
);
}
}
/**
/**
...
...
drivers/s390/net/lcs.c
View file @
e3f4c34c
...
@@ -1675,6 +1675,15 @@ lcs_portno_store (struct device *dev, const char *buf, size_t count)
...
@@ -1675,6 +1675,15 @@ lcs_portno_store (struct device *dev, const char *buf, size_t count)
static
DEVICE_ATTR
(
portno
,
0644
,
lcs_portno_show
,
lcs_portno_store
);
static
DEVICE_ATTR
(
portno
,
0644
,
lcs_portno_show
,
lcs_portno_store
);
static
struct
attribute
*
lcs_attrs
[]
=
{
&
dev_attr_portno
.
attr
,
NULL
,
};
static
struct
attribute_group
lcs_attr_group
=
{
.
attrs
=
lcs_attrs
,
};
/**
/**
* lcs_probe_device is called on establishing a new ccwgroup_device.
* lcs_probe_device is called on establishing a new ccwgroup_device.
*/
*/
...
@@ -1694,7 +1703,7 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
...
@@ -1694,7 +1703,7 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
put_device
(
&
ccwgdev
->
dev
);
put_device
(
&
ccwgdev
->
dev
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
ret
=
device_create_file
(
&
ccwgdev
->
dev
,
&
dev_attr_portno
);
ret
=
sysfs_create_group
(
&
ccwgdev
->
dev
.
kobj
,
&
lcs_attr_group
);
if
(
ret
)
{
if
(
ret
)
{
PRINT_ERR
(
"Creating attributes failed"
);
PRINT_ERR
(
"Creating attributes failed"
);
lcs_free_card
(
card
);
lcs_free_card
(
card
);
...
@@ -1826,6 +1835,7 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev)
...
@@ -1826,6 +1835,7 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev)
card
=
(
struct
lcs_card
*
)
ccwgdev
->
dev
.
driver_data
;
card
=
(
struct
lcs_card
*
)
ccwgdev
->
dev
.
driver_data
;
if
(
!
card
)
if
(
!
card
)
return
0
;
return
0
;
sysfs_remove_group
(
&
ccwgdev
->
dev
.
kobj
,
&
lcs_attr_group
);
lcs_cleanup_card
(
card
);
lcs_cleanup_card
(
card
);
lcs_free_card
(
card
);
lcs_free_card
(
card
);
put_device
(
&
ccwgdev
->
dev
);
put_device
(
&
ccwgdev
->
dev
);
...
...
drivers/s390/net/netiucv.c
View file @
e3f4c34c
...
@@ -1435,32 +1435,53 @@ txtime_write (struct device *dev, const char *buf, size_t count)
...
@@ -1435,32 +1435,53 @@ txtime_write (struct device *dev, const char *buf, size_t count)
static
DEVICE_ATTR
(
max_tx_io_time
,
0644
,
txtime_show
,
txtime_write
);
static
DEVICE_ATTR
(
max_tx_io_time
,
0644
,
txtime_show
,
txtime_write
);
static
struct
attribute
*
netiucv_attrs
[]
=
{
&
dev_attr_buffer
.
attr
,
NULL
,
};
static
struct
attribute_group
netiucv_attr_group
=
{
.
attrs
=
netiucv_attrs
,
};
static
struct
attribute
*
netiucv_stat_attrs
[]
=
{
&
dev_attr_device_fsm_state
.
attr
,
&
dev_attr_connection_fsm_state
.
attr
,
&
dev_attr_max_tx_buffer_used
.
attr
,
&
dev_attr_max_chained_skbs
.
attr
,
&
dev_attr_tx_single_write_ops
.
attr
,
&
dev_attr_tx_multi_write_ops
.
attr
,
&
dev_attr_netto_bytes
.
attr
,
&
dev_attr_max_tx_io_time
.
attr
,
NULL
,
};
static
struct
attribute_group
netiucv_stat_attr_group
=
{
.
name
=
"stats"
,
.
attrs
=
netiucv_stat_attrs
,
};
static
inline
int
static
inline
int
netiucv_add_files
(
struct
device
*
dev
)
netiucv_add_files
(
struct
device
*
dev
)
{
{
int
ret
=
0
;
int
ret
;
if
((
ret
=
device_create_file
(
dev
,
&
dev_attr_buffer
))
||
ret
=
sysfs_create_group
(
&
dev
->
kobj
,
&
netiucv_attr_group
);
(
ret
=
device_create_file
(
dev
,
&
dev_attr_device_fsm_state
))
||
if
(
ret
)
(
ret
=
device_create_file
(
dev
,
&
dev_attr_connection_fsm_state
))
||
return
ret
;
(
ret
=
device_create_file
(
dev
,
&
dev_attr_max_tx_buffer_used
))
||
ret
=
sysfs_create_group
(
&
dev
->
kobj
,
&
netiucv_stat_attr_group
);
(
ret
=
device_create_file
(
dev
,
&
dev_attr_max_chained_skbs
))
||
if
(
ret
)
(
ret
=
device_create_file
(
dev
,
&
dev_attr_tx_single_write_ops
))
||
sysfs_remove_group
(
&
dev
->
kobj
,
&
netiucv_stat_attr_group
);
(
ret
=
device_create_file
(
dev
,
&
dev_attr_tx_multi_write_ops
))
||
(
ret
=
device_create_file
(
dev
,
&
dev_attr_netto_bytes
))
||
(
ret
=
device_create_file
(
dev
,
&
dev_attr_max_tx_io_time
)))
{
device_remove_file
(
dev
,
&
dev_attr_netto_bytes
);
device_remove_file
(
dev
,
&
dev_attr_tx_multi_write_ops
);
device_remove_file
(
dev
,
&
dev_attr_tx_single_write_ops
);
device_remove_file
(
dev
,
&
dev_attr_max_chained_skbs
);
device_remove_file
(
dev
,
&
dev_attr_max_tx_buffer_used
);
device_remove_file
(
dev
,
&
dev_attr_connection_fsm_state
);
device_remove_file
(
dev
,
&
dev_attr_device_fsm_state
);
device_remove_file
(
dev
,
&
dev_attr_buffer
);
}
return
ret
;
return
ret
;
}
}
static
inline
void
netiucv_remove_files
(
struct
device
*
dev
)
{
sysfs_remove_group
(
&
dev
->
kobj
,
&
netiucv_stat_attr_group
);
sysfs_remove_group
(
&
dev
->
kobj
,
&
netiucv_stat_attr_group
);
}
static
int
static
int
netiucv_register_device
(
struct
net_device
*
ndev
,
int
ifno
)
netiucv_register_device
(
struct
net_device
*
ndev
,
int
ifno
)
{
{
...
@@ -1494,6 +1515,7 @@ netiucv_unregister_device(struct net_device *ndev)
...
@@ -1494,6 +1515,7 @@ netiucv_unregister_device(struct net_device *ndev)
struct
netiucv_priv
*
priv
=
(
struct
netiucv_priv
*
)
ndev
->
priv
;
struct
netiucv_priv
*
priv
=
(
struct
netiucv_priv
*
)
ndev
->
priv
;
struct
device
*
dev
=
&
priv
->
dev
;
struct
device
*
dev
=
&
priv
->
dev
;
netiucv_remove_files
(
dev
);
device_unregister
(
dev
);
device_unregister
(
dev
);
}
}
...
...
drivers/s390/net/qeth.c
View file @
e3f4c34c
...
@@ -10830,115 +10830,58 @@ qeth_recover_store(struct device *dev, const char *buf, size_t count)
...
@@ -10830,115 +10830,58 @@ qeth_recover_store(struct device *dev, const char *buf, size_t count)
static
DEVICE_ATTR
(
recover
,
0200
,
0
,
qeth_recover_store
);
static
DEVICE_ATTR
(
recover
,
0200
,
0
,
qeth_recover_store
);
static
inline
in
t
static
ssize_
t
__qeth_create_attributes
(
struct
device
*
dev
)
qeth_card_type_show
(
struct
device
*
dev
,
char
*
buf
)
{
{
int
ret
;
struct
qeth_card
*
card
=
dev
->
driver_data
;
ret
=
device_create_file
(
dev
,
&
dev_attr_bufcnt
);
if
(
ret
!=
0
)
goto
out_nobufcnt
;
ret
=
device_create_file
(
dev
,
&
dev_attr_portname
);
if
(
ret
!=
0
)
goto
out_noportname
;
ret
=
device_create_file
(
dev
,
&
dev_attr_route4
);
if
(
ret
!=
0
)
goto
out_noroute4
;
ret
=
device_create_file
(
dev
,
&
dev_attr_route6
);
if
(
ret
!=
0
)
goto
out_noroute6
;
ret
=
device_create_file
(
dev
,
&
dev_attr_checksumming
);
if
(
ret
!=
0
)
goto
out_nochecksum
;
ret
=
device_create_file
(
dev
,
&
dev_attr_priority_queueing
);
if
(
ret
!=
0
)
goto
out_noprioq
;
ret
=
device_create_file
(
dev
,
&
dev_attr_portno
);
if
(
ret
!=
0
)
goto
out_noportno
;
ret
=
device_create_file
(
dev
,
&
dev_attr_contig
);
if
(
ret
!=
0
)
goto
out_nocontig
;
ret
=
device_create_file
(
dev
,
&
dev_attr_polltime
);
if
(
ret
!=
0
)
goto
out_nopolltime
;
ret
=
device_create_file
(
dev
,
&
dev_attr_add_hhlen
);
if
(
ret
!=
0
)
goto
out_nohhlen
;
ret
=
device_create_file
(
dev
,
&
dev_attr_enable_takeover
);
if
(
ret
!=
0
)
goto
out_noipat
;
ret
=
device_create_file
(
dev
,
&
dev_attr_canonical_macaddr
);
if
(
ret
!=
0
)
goto
out_nomac
;
ret
=
device_create_file
(
dev
,
&
dev_attr_fake_broadcast
);
if
(
ret
!=
0
)
goto
out_nofakebr
;
ret
=
device_create_file
(
dev
,
&
dev_attr_fake_ll
);
if
(
!
card
)
if
(
ret
!=
0
)
return
-
EINVAL
;
goto
out_nofakell
;
ret
=
device_create_file
(
dev
,
&
dev_attr_async_hsi
);
if
(
!
atomic_read
(
&
card
->
is_softsetup
))
if
(
ret
!=
0
)
return
sprintf
(
buf
,
"n/a
\n
"
);
goto
out_nohsi
;
ret
=
device_create_file
(
dev
,
&
dev_attr_broadcast_mode
);
return
sprintf
(
buf
,
"%s
\n
"
,
if
(
ret
!=
0
)
qeth_get_cardname_short
(
card
->
type
,
card
->
link_type
,
goto
out_nobrmode
;
card
->
is_guest_lan
));
}
static
DEVICE_ATTR
(
card_type
,
0444
,
qeth_card_type_show
,
NULL
);
static
struct
attribute
*
qeth_attrs
[]
=
{
&
dev_attr_bufcnt
.
attr
,
&
dev_attr_portname
.
attr
,
&
dev_attr_route4
.
attr
,
&
dev_attr_route6
.
attr
,
&
dev_attr_checksumming
.
attr
,
&
dev_attr_priority_queueing
.
attr
,
&
dev_attr_portno
.
attr
,
&
dev_attr_polltime
.
attr
,
&
dev_attr_add_hhlen
.
attr
,
&
dev_attr_enable_takeover
.
attr
,
&
dev_attr_canonical_macaddr
.
attr
,
&
dev_attr_fake_broadcast
.
attr
,
&
dev_attr_fake_ll
.
attr
,
&
dev_attr_broadcast_mode
.
attr
,
&
dev_attr_recover
.
attr
,
&
dev_attr_card_type
.
attr
,
NULL
,
};
ret
=
device_create_file
(
dev
,
&
dev_attr_recover
);
static
struct
attribute_group
qeth_attr_group
=
{
if
(
ret
!=
0
)
.
attrs
=
qeth_attrs
,
goto
out_norecover
;
}
;
return
0
;
static
inline
int
__qeth_create_attributes
(
struct
device
*
dev
)
{
return
sysfs_create_group
(
&
dev
->
kobj
,
&
qeth_attr_group
);
}
out_norecover:
static
inline
void
device_remove_file
(
dev
,
&
dev_attr_broadcast_mode
);
__qeth_remove_attributes
(
struct
device
*
dev
)
out_nobrmode:
{
device_remove_file
(
dev
,
&
dev_attr_async_hsi
);
sysfs_remove_group
(
&
dev
->
kobj
,
&
qeth_attr_group
);
out_nohsi:
device_remove_file
(
dev
,
&
dev_attr_fake_ll
);
out_nofakell:
device_remove_file
(
dev
,
&
dev_attr_fake_broadcast
);
out_nofakebr:
device_remove_file
(
dev
,
&
dev_attr_canonical_macaddr
);
out_nomac:
device_remove_file
(
dev
,
&
dev_attr_enable_takeover
);
out_noipat:
device_remove_file
(
dev
,
&
dev_attr_add_hhlen
);
out_nohhlen:
device_remove_file
(
dev
,
&
dev_attr_polltime
);
out_nopolltime:
device_remove_file
(
dev
,
&
dev_attr_contig
);
out_nocontig:
device_remove_file
(
dev
,
&
dev_attr_portno
);
out_noportno:
device_remove_file
(
dev
,
&
dev_attr_priority_queueing
);
out_noprioq:
device_remove_file
(
dev
,
&
dev_attr_checksumming
);
out_nochecksum:
device_remove_file
(
dev
,
&
dev_attr_route6
);
out_noroute6:
device_remove_file
(
dev
,
&
dev_attr_route4
);
out_noroute4:
device_remove_file
(
dev
,
&
dev_attr_portname
);
out_noportname:
device_remove_file
(
dev
,
&
dev_attr_bufcnt
);
out_nobufcnt:
return
ret
;
}
}
static
int
static
int
...
@@ -11060,6 +11003,7 @@ qeth_remove_device(struct ccwgroup_device *gdev)
...
@@ -11060,6 +11003,7 @@ qeth_remove_device(struct ccwgroup_device *gdev)
{
{
struct
qeth_card
*
card
=
gdev
->
dev
.
driver_data
;
struct
qeth_card
*
card
=
gdev
->
dev
.
driver_data
;
__qeth_remove_attributes
(
&
gdev
->
dev
);
gdev
->
dev
.
driver_data
=
NULL
;
gdev
->
dev
.
driver_data
=
NULL
;
if
(
card
)
if
(
card
)
kfree
(
card
);
kfree
(
card
);
...
...
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