linux/drivers/s390/net
Julian Wiedmann 6319dcdaf9 s390/qeth: unbreak OSM and OSN support
commit 2d2ebb3ed0 upstream.

commit b4d72c08b3 ("qeth: bridgeport support - basic control")
broke the support for OSM and OSN devices as follows:

As OSM and OSN are L2 only, qeth_core_probe_device() does an early
setup by loading the l2 discipline and calling qeth_l2_probe_device().
In this context, adding the l2-specific bridgeport sysfs attributes
via qeth_l2_create_device_attributes() hits a BUG_ON in fs/sysfs/group.c,
since the basic sysfs infrastructure for the device hasn't been
established yet.

Note that OSN actually has its own unique sysfs attributes
(qeth_osn_devtype), so the additional attributes shouldn't be created
at all.
For OSM, add a new qeth_l2_devtype that contains all the common
and l2-specific sysfs attributes.
When qeth_core_probe_device() does early setup for OSM or OSN, assign
the corresponding devtype so that the ccwgroup probe code creates the
full set of sysfs attributes.
This allows us to skip qeth_l2_create_device_attributes() in case
of an early setup.

Any device that can't do early setup will initially have only the
generic sysfs attributes, and when it's probed later
qeth_l2_probe_device() adds the l2-specific attributes.

If an early-setup device is removed (by calling ccwgroup_ungroup()),
device_unregister() will - using the devtype - delete the
l2-specific attributes before qeth_l2_remove_device() is called.
So make sure to not remove them twice.

What complicates the issue is that qeth_l2_probe_device() and
qeth_l2_remove_device() is also called on a device when its
layer2 attribute changes (ie. its layer mode is switched).
For early-setup devices this wouldn't work properly - we wouldn't
remove the l2-specific attributes when switching to L3.
But switching the layer mode doesn't actually make any sense;
we already decided that the device can only operate in L2!
So just refuse to switch the layer mode on such devices. Note that
OSN doesn't have a layer2 attribute, so we only need to special-case
OSM.

Based on an initial patch by Ursula Braun.

Fixes: b4d72c08b3 ("qeth: bridgeport support - basic control")
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2017-09-15 18:29:34 +01:00
..
claw.c claw: replace PTR_RET with PTR_ERR_OR_ZERO 2014-04-28 13:44:10 -04:00
claw.h s390/s390dbf: use debug_level_enabled() where applicable 2013-10-24 17:16:54 +02:00
ctcm_dbug.c s390/s390dbf: use debug_level_enabled() where applicable 2013-10-24 17:16:54 +02:00
ctcm_dbug.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_fsms.c drivers/s390/net: removes unnecessary semicolon 2012-09-24 15:45:17 -04:00
ctcm_fsms.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_main.c ctc: replace PTR_RET with PTR_ERR_OR_ZERO 2014-04-28 13:44:10 -04:00
ctcm_main.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_mpc.c ctcm: remove BUG_ONs 2012-11-19 14:19:00 -05:00
ctcm_mpc.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
ctcm_sysfs.c s390/net: fix format string mismatches 2014-05-30 17:35:23 -07:00
fsm.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
fsm.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
Kconfig qeth: Update Kconfig wording 2013-01-21 13:51:15 -05:00
lcs.c s390/net: fix format string mismatches 2014-05-30 17:35:23 -07:00
lcs.h s390/s390dbf: use debug_level_enabled() where applicable 2013-10-24 17:16:54 +02:00
Makefile qeth: bridgeport support - basic control 2014-01-15 14:48:01 -08:00
netiucv.c netiucv: improve state checking in conn_action_txdone 2013-12-17 17:17:13 -05:00
qeth_core.h s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_core_main.c s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_core_mpc.c qeth: bridgeport support - address notifications 2014-01-15 14:48:01 -08:00
qeth_core_mpc.h qeth: bridgeport support - address notifications 2014-01-15 14:48:01 -08:00
qeth_core_sys.c s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_l2.h s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_l2_main.c s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_l2_sys.c s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_l3.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
qeth_l3_main.c s390/qeth: unbreak OSM and OSN support 2017-09-15 18:29:34 +01:00
qeth_l3_sys.c s390: replace strict_strtoul() with kstrtoul() 2013-08-22 12:20:00 +02:00
smsgiucv.c smsgiucv: reestablish IUCV path after resume 2012-10-16 14:41:46 -04:00
smsgiucv.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
smsgiucv_app.c Driver core: driver_find() drops reference before returning 2012-01-24 16:00:34 -08:00