Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp930338pxb; Thu, 5 Nov 2020 17:43:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHiOxzxEu3+4+NGLc3VUC3RbtW90O1R2iGskpv/hh4FLYtXICsgIoEsVRmzZkkPMFHMQAb X-Received: by 2002:a17:906:4e41:: with SMTP id g1mr5421341ejw.47.1604626986181; Thu, 05 Nov 2020 17:43:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604626986; cv=none; d=google.com; s=arc-20160816; b=s7H0MKUxoHtxj+s1n3atpYT4RLW5vT/CeQIe/BMyquDoux3+PoBh/UGRNN8AYMBCgc sLEg+aUse59jr5ES6YziBeD7C4+oHM53tBTqpZVrmbT7mRKICFW/Gl8Ijf74PoNDo4VD 5kzO/pJYykdLm5Wi2AonT+fZF1ngtmYalPMT9T+kgvDkSXtwVckLLS1DCfSTOKHMPzgP wuiDUcLjN6w0XMemYBPEfGBJw9iNJv7SeIjmM4Slg9n0M9oP+pFTCDkBFQykjGdppXYy y02jcLLzlxAe2fdKIzw/9i6F1fb/NzBV9g/MNEfps0p/ThMzsiTk21HI15a40lpWJDpv lLjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Dc6RxuMxg/b5CZ4VAdav7nmY0gC37n1qoDup8OB9Nwk=; b=cuNxfDhfKN3OWKNL8I/mNGKHL/yCiFtAWP4txcqp/uiX/oAj6Uj2R4eTPrvlrbhHvn GcX0dzT1LRfw+5D7I3S8gDY+n0Z+vHEMGRQsvQjrIBY/v/fPdvnNdqQcdiYWVnSlAl2h /huizAJSZ7qKWhgo2Tj7r/pDzw6GwLyMfjLsDdNEPvB5v/IlmBocixwTcgQ0CMdk8ewz j8NdTAgEl6e5tdFKz1mlcKYOXh7KdKI8HnztlENugXEkdTO79/NuuXa2irDsjeS6He3j cFAAjXOLdLJoUl6gt4yZJ13IaBRnPL6j7438E7VGKFGF/UeNlcoJxi7GkZt08iB6UzBW 8mbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LpklMJRL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si2515458edr.531.2020.11.05.17.42.43; Thu, 05 Nov 2020 17:43:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LpklMJRL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732636AbgKFBkX (ORCPT + 99 others); Thu, 5 Nov 2020 20:40:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:58024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730246AbgKFBkT (ORCPT ); Thu, 5 Nov 2020 20:40:19 -0500 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B10F220759; Fri, 6 Nov 2020 01:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604626819; bh=969kQmZ6XfP8mnESIv5YIDkBarsLQ2m+HXB+LOyk2Fw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LpklMJRLOwUiWu7UHq2a8ysBAlZTXKgvsWhlRASJOSJL5SpjPepQldCucKxXxheMG GLtlnbHLm7FsueRClbkJhAPqgan/3wFmrNb1fkRS7H3uYg/S8q92zk++affX1dBsTY Mu3ZWVFRZnSVkbf2Au4kLKgxVMYm2BjxtoZeRKMk= Date: Thu, 5 Nov 2020 17:40:17 -0800 From: Jakub Kicinski To: Pavana Sharma Cc: andrew@lunn.ch, ashkan.boldaji@digi.com, davem@davemloft.net, f.fainelli@gmail.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, marek.behun@nic.cz, netdev@vger.kernel.org, vivien.didelot@gmail.com Subject: Re: [PATCH v8 3/4] net: dsa: mv88e6xxx: Change serdes lane parameter from u8 type to int Message-ID: <20201105174017.48ddfa3e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Nov 2020 18:50:02 +1000 Pavana Sharma wrote: > Returning 0 is no more an error case with MV88E6393 family > which has serdes lane numbers 0, 9 or 10. > So with this change .serdes_get_lane will return lane number > or error (-ENODEV). > > Signed-off-by: Pavana Sharma > mv88e6xxx_reg_lock(chip); > lane = mv88e6xxx_serdes_get_lane(chip, port); > - if (lane && chip->info->ops->serdes_pcs_get_state) > + if ((lane >= 0) && chip->info->ops->serdes_pcs_get_state) unnecessary parenthesis, checkpatch even warns about this > err = chip->info->ops->serdes_pcs_get_state(chip, port, lane, > state); > else > @@ -522,15 +522,15 @@ static void mv88e6xxx_serdes_pcs_an_restart(struct dsa_switch *ds, int port) > { > struct mv88e6xxx_chip *chip = ds->priv; > const struct mv88e6xxx_ops *ops; > + int lane; > int err = 0; Please keep the reverse xmas tree order of variables int lane; should be after int err = 0; We're ordering full lines, not just the type and name. > - u8 lane; > > ops = chip->info->ops; > > if (ops->serdes_pcs_an_restart) { > mv88e6xxx_reg_lock(chip); > lane = mv88e6xxx_serdes_get_lane(chip, port); > - if (lane) > + if (lane >= 0) > err = ops->serdes_pcs_an_restart(chip, port, lane); > mv88e6xxx_reg_unlock(chip); > void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p) > { > - u16 *p = _p; > int lane; > + u16 *p = _p; > u16 reg; > int i; ditto > @@ -129,18 +129,18 @@ void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); > int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port); > void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); > > -/* Return the (first) SERDES lane address a port is using, 0 otherwise. */ > +/* Return the (first) SERDES lane address a port is using, ERROR otherwise. */ The usual notation is -errno, instead of ERROR.