All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
@ 2010-02-13 21:56 Philippe De Muyter
  2010-02-13 23:24 ` Chas Williams (CONTRACTOR)
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe De Muyter @ 2010-02-13 21:56 UTC (permalink / raw)
  To: chas, netdev

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>

--- 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;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-13 21:56 [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN) Philippe De Muyter
@ 2010-02-13 23:24 ` Chas Williams (CONTRACTOR)
  2010-02-14 17:51   ` Philippe De Muyter
  0 siblings, 1 reply; 8+ messages in thread
From: Chas Williams (CONTRACTOR) @ 2010-02-13 23:24 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-13 23:24 ` Chas Williams (CONTRACTOR)
@ 2010-02-14 17:51   ` Philippe De Muyter
  2010-02-14 21:34     ` Chas Williams (CONTRACTOR)
  2010-02-18 14:22     ` Chas Williams (CONTRACTOR)
  0 siblings, 2 replies; 8+ messages in thread
From: Philippe De Muyter @ 2010-02-14 17:51 UTC (permalink / raw)
  To: chas3; +Cc: netdev

Hi Chas,

On Sat, Feb 13, 2010 at 06:24:34PM -0500, Chas Williams (CONTRACTOR) wrote:
> 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.

OK for me.  I would agree with

	carrier = 0 when signal == ATM_PHY_SIG_UNKNOWN,

but currently we have

	carrier = 1 when signal == ATM_PHY_SIG_UNKNOWN

cxacru itself does the right thing : as soon as carrier state is known,
signal is set to ATM_PHY_SIG_LOST or ATM_PHY_SIG_FOUND, but
atm_sysfs.c::show_carrier is wrong.

So here is a revised patch :

--

The carrier field of /sys/devices/virtual/atm/cxacru0 shows 1 when carrier
is actually down (but unknown to linux).  Make it show 0 instead in that case.

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

--- a/net/atm/atm_sysfs.c	2010-02-14 18:17:05.604508129 +0100
+++ b/net/atm/atm_sysfs.c	2010-02-14 18:15:08.316917041 +0100
@@ -63,8 +63,7 @@ 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 == ATM_PHY_SIG_LOST ? 0 : 1);
+	pos += sprintf(pos, "%d\n", adev->signal == ATM_PHY_SIG_FOUND);
 
 	return pos - buf;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-14 17:51   ` Philippe De Muyter
@ 2010-02-14 21:34     ` Chas Williams (CONTRACTOR)
  2010-02-17  6:16       ` David Miller
  2010-02-18 14:22     ` Chas Williams (CONTRACTOR)
  1 sibling, 1 reply; 8+ messages in thread
From: Chas Williams (CONTRACTOR) @ 2010-02-14 21:34 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: netdev

In message <20100214175136.GA15891@frolo.macqel>,Philippe De Muyter writes:
>OK for me.  I would agree with
>
>	carrier = 0 when signal == ATM_PHY_SIG_UNKNOWN,
>
>but currently we have
>
>	carrier = 1 when signal == ATM_PHY_SIG_UNKNOWN

not quite what i said (or perhaps i didnt clearly convey my intent).
ATM_PHY_SIG_UNKNOWN is set during the driver create/initialize.
unfortunately, some drivers never bothers to set signal so it winds up
always being unknown.  however, for those drivers, we cant assume the
carrier is 0, or nothing will happen if someone is watching for the
carrier to be 1.

so, all drivers, if they arent going to support setting signal should
just assign it to 1.  i would sort of prefer that ATM_PHY_SIG_UNKNOWN
simply didnt exist.  as i said before there is carrier or there is
not.  if the driver doesnt support checking/knowing the carrier status
it should simply say 'yes i have carrier'.

i will see if i cant workup a little patch for this today.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-14 21:34     ` Chas Williams (CONTRACTOR)
@ 2010-02-17  6:16       ` David Miller
  2010-02-17 11:35         ` Philippe De Muyter
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2010-02-17  6:16 UTC (permalink / raw)
  To: chas3, chas; +Cc: phdm, netdev

From: "Chas Williams (CONTRACTOR)" <chas@cmf.nrl.navy.mil>
Date: Sun, 14 Feb 2010 16:34:40 -0500

> as i said before there is carrier or there is not.  if the driver
> doesnt support checking/knowing the carrier status it should simply
> say 'yes i have carrier'.

I agree %100 and this is how we handle similar situations
for other networking device types.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-17  6:16       ` David Miller
@ 2010-02-17 11:35         ` Philippe De Muyter
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe De Muyter @ 2010-02-17 11:35 UTC (permalink / raw)
  To: David Miller; +Cc: chas3, chas, netdev

Hi Chas, David,

On Tue, Feb 16, 2010 at 10:16:51PM -0800, David Miller wrote:
> From: "Chas Williams (CONTRACTOR)" <chas@cmf.nrl.navy.mil>
> Date: Sun, 14 Feb 2010 16:34:40 -0500
> 
> > as i said before there is carrier or there is not.  if the driver
> > doesnt support checking/knowing the carrier status it should simply
> > say 'yes i have carrier'.
> 
> I agree %100 and this is how we handle similar situations
> for other networking device types.

I also agree 100% with that : the low-level driver must do that, not the
generic class driver.  Here cxacru is punished because other atm drivers
forget to set signal = ATM_PHY_SIG_FOUND.

Philippe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-14 17:51   ` Philippe De Muyter
  2010-02-14 21:34     ` Chas Williams (CONTRACTOR)
@ 2010-02-18 14:22     ` Chas Williams (CONTRACTOR)
  2013-08-08  8:34       ` Philippe De Muyter
  1 sibling, 1 reply; 8+ messages in thread
From: Chas Williams (CONTRACTOR) @ 2010-02-18 14:22 UTC (permalink / raw)
  To: Philippe De Muyter; +Cc: netdev

In message <20100214175136.GA15891@frolo.macqel>,Philippe De Muyter writes:
>cxacru itself does the right thing : as soon as carrier state is known,
>signal is set to ATM_PHY_SIG_LOST or ATM_PHY_SIG_FOUND, but
>atm_sysfs.c::show_carrier is wrong.

so, i was thinking about something like this.  atm_dev->signal is
initializated to _LOST (because it is at this point), but most drivers
will set ->signal to _FOUND since they dont handle detecting carrier
when they finish their hardware initialization.  the usb atm layer 
is the major exception here, and it appears that they already handle
the atm_dev->signal status correctly.  the minor exception being
"unknown line state" -- i am going to assume LOST is the best choice
for this case.

please try this and let me know if it fixes your problem.

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 5effec6..2b9315f 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -134,6 +134,7 @@ static int __init adummy_init(void)
 	}
 
 	list_add(&adummy_dev->entry, &adummy_devs);
+	atm_dev->signal = ATM_PHY_SIG_FOUND;
 out:
 	return err;
 
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 8af2341..31e9baa 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -2269,6 +2269,7 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_
 	// enable host interrupts
 	interrupts_on (dev);
 
+	dev->atm_dev->signal = ATM_PHY_SIG_FOUND;
 out:
 	return err;
 
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 02ad83d..82ae3cc 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -375,6 +375,7 @@ static int atmtcp_create(int itf,int persist,struct atm_dev **result)
 	dev->dev_data = dev_data;
 	PRIV(dev)->vcc = NULL;
 	PRIV(dev)->persist = persist;
+	dev->signal = ATM_PHY_SIG_FOUND;
 	if (result) *result = dev;
 	return 0;
 }
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index cd5049a..b6cb376 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1923,6 +1923,7 @@ static int __devinit firestream_init_one (struct pci_dev *pci_dev,
 
 	fs_dev->next = fs_boards;
 	fs_boards = fs_dev;
+	atm_dev->signal = ATM_PHY_SIG_FOUND;
 	return 0;
 
  err_out_free_atm_dev:
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index f7d6eba..ad2d919 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2637,6 +2637,7 @@ fore200e_init(struct fore200e* fore200e)
 
     /* all done, board initialization is now complete */
     fore200e->state = FORE200E_STATE_COMPLETE;
+    fore200e->atm_dev->signal = ATM_PHY_SIG_FOUND;
     return 0;
 }
 
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index e8c6529..ae83f9e 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1528,6 +1528,8 @@ he_start(struct atm_dev *dev)
 		suni_init(he_dev->atm_dev);
 	if (he_dev->atm_dev->phy && he_dev->atm_dev->phy->start)
 		he_dev->atm_dev->phy->start(he_dev->atm_dev);
+#else
+	he_dev->atm_dev->signal = ATM_PHY_SIG_FOUND;
 #endif /* CONFIG_ATM_HE_USE_SUNI */
 
 	if (sdh) {
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 4e49021..269c01f 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2827,6 +2827,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
 	dev->housekeeping.data = (unsigned long) dev;
 	mod_timer(&dev->housekeeping, jiffies);
 
+	dev->atm_dev->signal = ATM_PHY_SIG_FOUND;
 out:
 	return err;
 
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 01f36c0..adc5eee 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3715,6 +3715,8 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
 		err = -EIO;
 		goto err_out_deinit_card;
 	}
+#else
+	dev->signal = ATM_PHY_SIG_FOUND;
 #endif	/* CONFIG_ATM_IDT77252_USE_SUNI */
 
 	card->sramsize = probe_sram(card);
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 7fe7c32..446cc67 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -2250,6 +2250,7 @@ static int __devinit lanai_dev_open(struct atm_dev *atmdev)
 	    "board_rev=%d\n", lanai->number,
 	    lanai->type==lanai2 ? "2" : "HB", (unsigned int) lanai->serialno,
 	    (unsigned int) lanai->serialno, lanai->board_rev);
+	atmdev->signal = ATM_PHY_SIG_FOUND;
 	return 0;
 
     error_vcctable:
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 5083840..02fb6a6 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -815,14 +815,18 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
    card->atmdev->link_rate = card->max_pcr;
    card->atmdev->phy = NULL;
 
-#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
    if (card->max_pcr == ATM_OC3_PCR)
+#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
       suni_init(card->atmdev);
+#else
+       card->atmdev->signal = ATM_PHY_SIG_FOUND;
 #endif /* CONFIG_ATM_NICSTAR_USE_SUNI */
 
-#ifdef CONFIG_ATM_NICSTAR_USE_IDT77105
    if (card->max_pcr == ATM_25_PCR)
+#ifdef CONFIG_ATM_NICSTAR_USE_IDT77105
       idt77105_init(card->atmdev);
+#else
+      card->atmdev->signal = ATM_PHY_SIG_FOUND;
 #endif /* CONFIG_ATM_NICSTAR_USE_IDT77105 */
 
    if (card->atmdev->phy && card->atmdev->phy->start)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 51eed67..0e505f5 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1245,7 +1245,7 @@ static int atm_init(struct solos_card *card)
 		card->atmdev[i]->ci_range.vci_bits = 16;
 		card->atmdev[i]->dev_data = card;
 		card->atmdev[i]->phy_data = (void *)(unsigned long)i;
-		card->atmdev[i]->signal = ATM_PHY_SIG_UNKNOWN;
+		card->atmdev[i]->signal = ATM_PHY_SIG_LOST;
 
 		skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
 		if (!skb) {
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 2e9635b..99712f0 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1345,6 +1345,8 @@ static int __devinit zatm_start(struct atm_dev *dev)
 	zout(0xffffffff,IMR); /* enable interrupts */
 	/* enable TX & RX */
 	zout(zin(GMR) | uPD98401_GMR_SE | uPD98401_GMR_RE,GMR);
+
+	dev->signal = ATM_PHY_SIG_FOUND;
 done:
 	return error;
 
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 56802d2..febe1f0 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -803,7 +803,7 @@ static void cxacru_poll_status(struct work_struct *work)
 		break;
 
 	default:
-		atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+		atm_dev->signal = ATM_PHY_SIG_LOST;
 		atm_info(usbatm, "Unknown line state %02x\n", instance->line_status);
 		break;
 	}
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 3e86240..fe19fe4 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -536,7 +536,7 @@ static void speedtch_check_status(struct work_struct *work)
 			break;
 
 		case 0x08:
-			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+			atm_dev->signal = ATM_PHY_SIG_LOST;
 			atm_info(usbatm, "ADSL line is blocked?\n");
 			break;
 
@@ -565,7 +565,7 @@ static void speedtch_check_status(struct work_struct *work)
 			break;
 
 		default:
-			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+			atm_dev->signal = ATM_PHY_SIG_LOST;
 			atm_info(usbatm, "unknown line state %02x\n", status);
 			break;
 		}
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index fbea856..10899ec 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -963,7 +963,7 @@ static int usbatm_atm_init(struct usbatm_data *instance)
 
 	atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
 	atm_dev->ci_range.vci_bits = ATM_CI_MAX;
-	atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+	atm_dev->signal = ATM_PHY_SIG_LOST;
 
 	/* temp init ATM device, set to 128kbit */
 	atm_dev->link_rate = 128 * 1000 / 424;
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b237..6e3db35 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -290,7 +290,6 @@ enum {
 
 
 #define ATM_PHY_SIG_LOST    0	/* no carrier/light */
-#define ATM_PHY_SIG_UNKNOWN 1	/* carrier/light status is unknown */
 #define ATM_PHY_SIG_FOUND   2	/* carrier/light okay */
 
 #define ATM_ATMOPT_CLP	1	/* set CLP bit */
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index f693b78..a560857 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -65,7 +65,7 @@ static ssize_t show_carrier(struct device *cdev,
 	struct atm_dev *adev = to_atm_dev(cdev);
 
 	pos += sprintf(pos, "%d\n",
-		       adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
+		       adev->signal == ATM_PHY_SIG_FOUND);
 
 	return pos - buf;
 }
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 9008290..2d5f95f 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -38,7 +38,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
 	if (!dev)
 		return NULL;
 	dev->type = type;
-	dev->signal = ATM_PHY_SIG_UNKNOWN;
+	dev->signal = ATM_PHY_SIG_LOST;
 	dev->link_rate = ATM_OC3_PCR;
 	spin_lock_init(&dev->lock);
 	INIT_LIST_HEAD(&dev->local);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN)
  2010-02-18 14:22     ` Chas Williams (CONTRACTOR)
@ 2013-08-08  8:34       ` Philippe De Muyter
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe De Muyter @ 2013-08-08  8:34 UTC (permalink / raw)
  To: chas3; +Cc: netdev

On Thu, Feb 18, 2010 at 09:22:53AM -0500, Chas Williams (CONTRACTOR) wrote:
> In message <20100214175136.GA15891@frolo.macqel>,Philippe De Muyter writes:
> >cxacru itself does the right thing : as soon as carrier state is known,
> >signal is set to ATM_PHY_SIG_LOST or ATM_PHY_SIG_FOUND, but
> >atm_sysfs.c::show_carrier is wrong.
> 
> so, i was thinking about something like this.  atm_dev->signal is
> initializated to _LOST (because it is at this point), but most drivers
> will set ->signal to _FOUND since they dont handle detecting carrier
> when they finish their hardware initialization.  the usb atm layer 
> is the major exception here, and it appears that they already handle
> the atm_dev->signal status correctly.  the minor exception being
> "unknown line state" -- i am going to assume LOST is the best choice
> for this case.
> 
> please try this and let me know if it fixes your problem.

I had replied on Sun, 21 Feb 2010 15:42:04 +0100

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

Did you push that patch, or a revised version of it, to Linus ?

Best regards

Philippe
> 
> diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
> index 5effec6..2b9315f 100644
> --- a/drivers/atm/adummy.c
> +++ b/drivers/atm/adummy.c
> @@ -134,6 +134,7 @@ static int __init adummy_init(void)
>  	}
>  
>  	list_add(&adummy_dev->entry, &adummy_devs);
> +	atm_dev->signal = ATM_PHY_SIG_FOUND;
>  out:
>  	return err;
>  
> diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
> index 8af2341..31e9baa 100644
> --- a/drivers/atm/ambassador.c
> +++ b/drivers/atm/ambassador.c
> @@ -2269,6 +2269,7 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_
>  	// enable host interrupts
>  	interrupts_on (dev);
>  
> +	dev->atm_dev->signal = ATM_PHY_SIG_FOUND;
>  out:
>  	return err;
>  
> diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
> index 02ad83d..82ae3cc 100644
> --- a/drivers/atm/atmtcp.c
> +++ b/drivers/atm/atmtcp.c
> @@ -375,6 +375,7 @@ static int atmtcp_create(int itf,int persist,struct atm_dev **result)
>  	dev->dev_data = dev_data;
>  	PRIV(dev)->vcc = NULL;
>  	PRIV(dev)->persist = persist;
> +	dev->signal = ATM_PHY_SIG_FOUND;
>  	if (result) *result = dev;
>  	return 0;
>  }
> diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
> index cd5049a..b6cb376 100644
> --- a/drivers/atm/firestream.c
> +++ b/drivers/atm/firestream.c
> @@ -1923,6 +1923,7 @@ static int __devinit firestream_init_one (struct pci_dev *pci_dev,
>  
>  	fs_dev->next = fs_boards;
>  	fs_boards = fs_dev;
> +	atm_dev->signal = ATM_PHY_SIG_FOUND;
>  	return 0;
>  
>   err_out_free_atm_dev:
> diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
> index f7d6eba..ad2d919 100644
> --- a/drivers/atm/fore200e.c
> +++ b/drivers/atm/fore200e.c
> @@ -2637,6 +2637,7 @@ fore200e_init(struct fore200e* fore200e)
>  
>      /* all done, board initialization is now complete */
>      fore200e->state = FORE200E_STATE_COMPLETE;
> +    fore200e->atm_dev->signal = ATM_PHY_SIG_FOUND;
>      return 0;
>  }
>  
> diff --git a/drivers/atm/he.c b/drivers/atm/he.c
> index e8c6529..ae83f9e 100644
> --- a/drivers/atm/he.c
> +++ b/drivers/atm/he.c
> @@ -1528,6 +1528,8 @@ he_start(struct atm_dev *dev)
>  		suni_init(he_dev->atm_dev);
>  	if (he_dev->atm_dev->phy && he_dev->atm_dev->phy->start)
>  		he_dev->atm_dev->phy->start(he_dev->atm_dev);
> +#else
> +	he_dev->atm_dev->signal = ATM_PHY_SIG_FOUND;
>  #endif /* CONFIG_ATM_HE_USE_SUNI */
>  
>  	if (sdh) {
> diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
> index 4e49021..269c01f 100644
> --- a/drivers/atm/horizon.c
> +++ b/drivers/atm/horizon.c
> @@ -2827,6 +2827,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_
>  	dev->housekeeping.data = (unsigned long) dev;
>  	mod_timer(&dev->housekeeping, jiffies);
>  
> +	dev->atm_dev->signal = ATM_PHY_SIG_FOUND;
>  out:
>  	return err;
>  
> diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
> index 01f36c0..adc5eee 100644
> --- a/drivers/atm/idt77252.c
> +++ b/drivers/atm/idt77252.c
> @@ -3715,6 +3715,8 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
>  		err = -EIO;
>  		goto err_out_deinit_card;
>  	}
> +#else
> +	dev->signal = ATM_PHY_SIG_FOUND;
>  #endif	/* CONFIG_ATM_IDT77252_USE_SUNI */
>  
>  	card->sramsize = probe_sram(card);
> diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
> index 7fe7c32..446cc67 100644
> --- a/drivers/atm/lanai.c
> +++ b/drivers/atm/lanai.c
> @@ -2250,6 +2250,7 @@ static int __devinit lanai_dev_open(struct atm_dev *atmdev)
>  	    "board_rev=%d\n", lanai->number,
>  	    lanai->type==lanai2 ? "2" : "HB", (unsigned int) lanai->serialno,
>  	    (unsigned int) lanai->serialno, lanai->board_rev);
> +	atmdev->signal = ATM_PHY_SIG_FOUND;
>  	return 0;
>  
>      error_vcctable:
> diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
> index 5083840..02fb6a6 100644
> --- a/drivers/atm/nicstar.c
> +++ b/drivers/atm/nicstar.c
> @@ -815,14 +815,18 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
>     card->atmdev->link_rate = card->max_pcr;
>     card->atmdev->phy = NULL;
>  
> -#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
>     if (card->max_pcr == ATM_OC3_PCR)
> +#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
>        suni_init(card->atmdev);
> +#else
> +       card->atmdev->signal = ATM_PHY_SIG_FOUND;
>  #endif /* CONFIG_ATM_NICSTAR_USE_SUNI */
>  
> -#ifdef CONFIG_ATM_NICSTAR_USE_IDT77105
>     if (card->max_pcr == ATM_25_PCR)
> +#ifdef CONFIG_ATM_NICSTAR_USE_IDT77105
>        idt77105_init(card->atmdev);
> +#else
> +      card->atmdev->signal = ATM_PHY_SIG_FOUND;
>  #endif /* CONFIG_ATM_NICSTAR_USE_IDT77105 */
>  
>     if (card->atmdev->phy && card->atmdev->phy->start)
> diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
> index 51eed67..0e505f5 100644
> --- a/drivers/atm/solos-pci.c
> +++ b/drivers/atm/solos-pci.c
> @@ -1245,7 +1245,7 @@ static int atm_init(struct solos_card *card)
>  		card->atmdev[i]->ci_range.vci_bits = 16;
>  		card->atmdev[i]->dev_data = card;
>  		card->atmdev[i]->phy_data = (void *)(unsigned long)i;
> -		card->atmdev[i]->signal = ATM_PHY_SIG_UNKNOWN;
> +		card->atmdev[i]->signal = ATM_PHY_SIG_LOST;
>  
>  		skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
>  		if (!skb) {
> diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
> index 2e9635b..99712f0 100644
> --- a/drivers/atm/zatm.c
> +++ b/drivers/atm/zatm.c
> @@ -1345,6 +1345,8 @@ static int __devinit zatm_start(struct atm_dev *dev)
>  	zout(0xffffffff,IMR); /* enable interrupts */
>  	/* enable TX & RX */
>  	zout(zin(GMR) | uPD98401_GMR_SE | uPD98401_GMR_RE,GMR);
> +
> +	dev->signal = ATM_PHY_SIG_FOUND;
>  done:
>  	return error;
>  
> diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
> index 56802d2..febe1f0 100644
> --- a/drivers/usb/atm/cxacru.c
> +++ b/drivers/usb/atm/cxacru.c
> @@ -803,7 +803,7 @@ static void cxacru_poll_status(struct work_struct *work)
>  		break;
>  
>  	default:
> -		atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
> +		atm_dev->signal = ATM_PHY_SIG_LOST;
>  		atm_info(usbatm, "Unknown line state %02x\n", instance->line_status);
>  		break;
>  	}
> diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
> index 3e86240..fe19fe4 100644
> --- a/drivers/usb/atm/speedtch.c
> +++ b/drivers/usb/atm/speedtch.c
> @@ -536,7 +536,7 @@ static void speedtch_check_status(struct work_struct *work)
>  			break;
>  
>  		case 0x08:
> -			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
> +			atm_dev->signal = ATM_PHY_SIG_LOST;
>  			atm_info(usbatm, "ADSL line is blocked?\n");
>  			break;
>  
> @@ -565,7 +565,7 @@ static void speedtch_check_status(struct work_struct *work)
>  			break;
>  
>  		default:
> -			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
> +			atm_dev->signal = ATM_PHY_SIG_LOST;
>  			atm_info(usbatm, "unknown line state %02x\n", status);
>  			break;
>  		}
> diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
> index fbea856..10899ec 100644
> --- a/drivers/usb/atm/usbatm.c
> +++ b/drivers/usb/atm/usbatm.c
> @@ -963,7 +963,7 @@ static int usbatm_atm_init(struct usbatm_data *instance)
>  
>  	atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
>  	atm_dev->ci_range.vci_bits = ATM_CI_MAX;
> -	atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
> +	atm_dev->signal = ATM_PHY_SIG_LOST;
>  
>  	/* temp init ATM device, set to 128kbit */
>  	atm_dev->link_rate = 128 * 1000 / 424;
> diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
> index 817b237..6e3db35 100644
> --- a/include/linux/atmdev.h
> +++ b/include/linux/atmdev.h
> @@ -290,7 +290,6 @@ enum {
>  
>  
>  #define ATM_PHY_SIG_LOST    0	/* no carrier/light */
> -#define ATM_PHY_SIG_UNKNOWN 1	/* carrier/light status is unknown */
>  #define ATM_PHY_SIG_FOUND   2	/* carrier/light okay */
>  
>  #define ATM_ATMOPT_CLP	1	/* set CLP bit */
> diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
> index f693b78..a560857 100644
> --- a/net/atm/atm_sysfs.c
> +++ b/net/atm/atm_sysfs.c
> @@ -65,7 +65,7 @@ static ssize_t show_carrier(struct device *cdev,
>  	struct atm_dev *adev = to_atm_dev(cdev);
>  
>  	pos += sprintf(pos, "%d\n",
> -		       adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
> +		       adev->signal == ATM_PHY_SIG_FOUND);
>  
>  	return pos - buf;
>  }
> diff --git a/net/atm/resources.c b/net/atm/resources.c
> index 9008290..2d5f95f 100644
> --- a/net/atm/resources.c
> +++ b/net/atm/resources.c
> @@ -38,7 +38,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
>  	if (!dev)
>  		return NULL;
>  	dev->type = type;
> -	dev->signal = ATM_PHY_SIG_UNKNOWN;
> +	dev->signal = ATM_PHY_SIG_LOST;
>  	dev->link_rate = ATM_OC3_PCR;
>  	spin_lock_init(&dev->lock);
>  	INIT_LIST_HEAD(&dev->local);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-08  8:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-13 21:56 [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN) Philippe De Muyter
2010-02-13 23:24 ` Chas Williams (CONTRACTOR)
2010-02-14 17:51   ` Philippe De Muyter
2010-02-14 21:34     ` Chas Williams (CONTRACTOR)
2010-02-17  6:16       ` David Miller
2010-02-17 11:35         ` Philippe De Muyter
2010-02-18 14:22     ` Chas Williams (CONTRACTOR)
2013-08-08  8:34       ` Philippe De Muyter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.