From patchwork Sun Feb 14 17:51:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe De Muyter X-Patchwork-Id: 45331 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 81E50B7CF1 for ; Mon, 15 Feb 2010 04:52:24 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635Ab0BNRvy (ORCPT ); Sun, 14 Feb 2010 12:51:54 -0500 Received: from mailrelay007.isp.belgacom.be ([195.238.6.173]:24894 "EHLO mailrelay007.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752489Ab0BNRvw (ORCPT ); Sun, 14 Feb 2010 12:51:52 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAIbHd0vCTtAn/2dsb2JhbACbHXS7GYRbBA Received: from mail.macqel.be ([194.78.208.39]) by relay.skynet.be with ESMTP; 14 Feb 2010 18:51:38 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.macqel.be (Postfix) with ESMTP id 4EB44130C7A; Sun, 14 Feb 2010 18:51:38 +0100 (CET) X-Virus-Scanned: amavisd-new at macqel.be Received: from mail.macqel.be ([127.0.0.1]) by localhost (mail.macqel.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2+gia6A1edYY; Sun, 14 Feb 2010 18:51:36 +0100 (CET) Received: from frolo.macqel.be (frolo.macqel [10.1.40.73]) by mail.macqel.be (Postfix) with ESMTP id 62DA5130AA1; Sun, 14 Feb 2010 18:51:36 +0100 (CET) Received: by frolo.macqel.be (Postfix, from userid 1000) id 56A4CFE403B; Sun, 14 Feb 2010 18:51:36 +0100 (CET) Date: Sun, 14 Feb 2010 18:51:36 +0100 From: Philippe De Muyter To: chas3@users.sourceforge.net Cc: netdev@vger.kernel.org Subject: Re: [PATCH] atm : fix /sys/devices/virtual/atm/X/carrier(ATM_PHY_SIG_UNKNOWN) Message-ID: <20100214175136.GA15891@frolo.macqel> References: <20100213215633.GA4345@frolo.macqel> <201002132324.o1DNOY0F030510@thirdoffive.cmf.nrl.navy.mil> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201002132324.o1DNOY0F030510@thirdoffive.cmf.nrl.navy.mil> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 -- 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 --- 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; }