Received: by 10.223.185.116 with SMTP id b49csp1071083wrg; Fri, 23 Feb 2018 11:23:21 -0800 (PST) X-Google-Smtp-Source: AH8x225N9rVxFV9jgjLL9kihzVJyfurOp5TAO74fICpU9YW8PIUXG/8WIkwu/+lpktohTZ8DIdOM X-Received: by 2002:a17:902:1a4:: with SMTP id b33-v6mr2589593plb.321.1519413801782; Fri, 23 Feb 2018 11:23:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519413801; cv=none; d=google.com; s=arc-20160816; b=kjsQ4jZPMvHGFjsmR6b+zT76LdcV8dklCByK6/2PhLEGt7Hcg32TWEromZExQ10O9l Lagu7pTIbrLZHFYriOjVxuMJJx1p3w1zyLlByER6jnp32nTOjdGyYQK63HM8LQ14fWfM zgRAc2SEHaWFEgTWavqsPiehMRfU3Gw2tSTofnps0YdSg2EehzzaER/hqrQ0IirIbb98 KK34h6FX/X+K/co2fX3iZBSiybe8sGZ6wuQbq4D/QV3raClJk4gqOwpuy6jTyf+ZQciY ZIVB880l8ke0dpwu5QBjpSYTDn6Yvc9IznQ7Luka/XRVBrM/i75OFZRJypZduv2pq/l5 gYAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CCOmxehAaXA8hxnBXbsai9nXA+kWnhmoZ4KrO0M/7do=; b=MLXyT/WKe3ykbYP7k/m1M5kkzmEtX9tp4h2c87Vbx4hKqnxPMHw0EN0EDlkXwoYY46 PgXU5j7vUdawGgFaF6kFxWGhLzl2ohO6QXOoSCRsQEojan9JK3vjVOAWsKlTYfbk5ioz DClfbzNpTkpKA8EhgERY2auhqE3OBTTuWZF6jW+9SNs9zaWZW0uvb6lbyvqAy/dAImS2 QfFoLlY1q88GxYSKjdFJ9F6iWhlMAJU0RlFfWQ4FYOhHFXT8qDv5B+ou06Ht3QSu9BmY qzYAZlWyNU4hRVJ53QEMC/0TGu4myV6ccVq/nA+8Mjd22xgolrLsLoudstzLVZSDRUqh f1nQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n129si1863866pga.186.2018.02.23.11.23.07; Fri, 23 Feb 2018 11:23:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754634AbeBWTWd (ORCPT + 99 others); Fri, 23 Feb 2018 14:22:33 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47434 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964786AbeBWSxi (ORCPT ); Fri, 23 Feb 2018 13:53:38 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C50641052; Fri, 23 Feb 2018 18:53:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Russell King , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 096/159] sfp: fix RX_LOS signal handling Date: Fri, 23 Feb 2018 19:26:44 +0100 Message-Id: <20180223170755.130238598@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Russell King [ Upstream commit acf1c02f023926b8b04672a9e81b1711ae681619 ] The options word is a be16 quantity, so we need to test the flags having converted the endian-ness. Convert the flag bits to be16, which can be optimised by the compiler, rather than converting a variable at runtime. Reported-by: Florian Fainelli Signed-off-by: Russell King Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/sfp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -358,7 +358,7 @@ static void sfp_sm_link_check_los(struct * SFP_OPTIONS_LOS_NORMAL are set? For now, we assume * the same as SFP_OPTIONS_LOS_NORMAL set. */ - if (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED) + if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED)) los ^= SFP_F_LOS; if (los) @@ -583,7 +583,8 @@ static void sfp_sm_event(struct sfp *sfp if (event == SFP_E_TX_FAULT) sfp_sm_fault(sfp, true); else if (event == - (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ? + (sfp->id.ext.options & + cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) ? SFP_E_LOS_HIGH : SFP_E_LOS_LOW)) sfp_sm_link_up(sfp); break; @@ -593,7 +594,8 @@ static void sfp_sm_event(struct sfp *sfp sfp_sm_link_down(sfp); sfp_sm_fault(sfp, true); } else if (event == - (sfp->id.ext.options & SFP_OPTIONS_LOS_INVERTED ? + (sfp->id.ext.options & + cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) ? SFP_E_LOS_LOW : SFP_E_LOS_HIGH)) { sfp_sm_link_down(sfp); sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);