diff mbox

atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)

Message ID 20100213215633.GA4345@frolo.macqel
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Philippe De Muyter Feb. 13, 2010, 9:56 p.m. UTC
When trying to design udev rules to automate usage of cxacru usb atm (adsl)
modem, I have discovered that /sys/devices/virtual/atm/cxacru0/carrier had the
value '1' while actually carrier was not yet established and real carrier
state was not yet known to linux.  I propose to fix that by using '?' as the
/sys/devices/virtual/atm/cxacru0/carrier value when carrier state is not yet
known to linux.  Any other value except '1' would also be OK for me.

--
Currently, just after the interface creation,
/sys/devices/virtual/atm/cxacru0/carrier gives wrong info (carrier = 1),
while actually carrier is unknown.  Fix that.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

chas williams - CONTRACTOR Feb. 13, 2010, 11:24 p.m. UTC | #1
In message <20100213215633.GA4345@frolo.macqel>,Philippe De Muyter writes:
>value '1' while actually carrier was not yet established and real carrier
>state was not yet known to linux.  I propose to fix that by using '?' as the
>/sys/devices/virtual/atm/cxacru0/carrier value when carrier state is not yet
>known to linux.  Any other value except '1' would also be OK for me.

this is sort of intentional because some drivers dont actually implement
atm_dev->signal.  ATM_PHY_SIG_UNKNOWN and ATM_PHY_SIG_LOST should
likely be carrier = 0.  if the driver doesnt isnt going to handle
changing the state of atm_dev->signal it should just set the value to
ATM_PHY_SIG_FOUND.

i dont like the idea of carrier being '?' -- carrier is either true or false.
you have it or you dont.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/net/atm/atm_sysfs.c	2010-02-13 22:54:04.598847195 +0100
+++ b/net/atm/atm_sysfs.c	2010-02-13 19:13:45.395308531 +0100
@@ -63,9 +63,9 @@  static ssize_t show_carrier(struct devic
 	char *pos = buf;
 	struct atm_dev *adev = to_atm_dev(cdev);
 
-	pos += sprintf(pos, "%d\n",
-		       adev->signal ==
-		       adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
+	pos += sprintf(pos, "%c\n",
+		       adev->signal == ATM_PHY_SIG_FOUND ? '1' :
+		       adev->signal == ATM_PHY_SIG_LOST ? '0' : '?');
 
 	return pos - buf;
 }