From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49ADAC433EF for ; Sun, 2 Jan 2022 16:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FMg4nDyIjch01qj3bZO7YIFPHKGYTEtq3y4hUr+AdsE=; b=XPqTVIwoXLI9en /PFzLFnkfNNjI9xlfmoHljjPW0B69ZINU5VmM1JOlt6SDOCnRVGN9a33+Z3v+gz+jCeFckdUGzJFV +YTkGkxcMu0OaZZ8yeqBCql2CaSEgJ4qb1/cXW/YrHlEXPjUsWHdBaE9u1pul85dZ+reCYu6wpC8Q ul0xOubuEER6OBB5wEcODuW4l5MVZQRSM8oipz8Vw3upJTAkUb4WDvMKvrANH0+GBAD0x5gRQ6Oaj BMHTm1F2TK6N76+7VSND5k+7ruWiyGggog9ySMlPapUtKxAz3IQiXXf87ibCz05f+X42andFNzeg5 CtKh4Urg0LZyIUuvsxJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n43xN-007xmM-My; Sun, 02 Jan 2022 16:43:41 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n43xK-007xlv-6k; Sun, 02 Jan 2022 16:43:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=p6z6R4Zq+iBUkifmKKYAC9qMQJ+15+ZEEM8C6DzOWp8=; b=j7 Yd+uaaPiOFOfX2kH4cp/I+XeYgzct+wydzajip0fLO0Yk37F78L5G6gguHWqTriOxFYKkv33fa0K0 12j066oLGvT7SlKZzZGl3LX5L0dA37ypyJYGDWEo6e06fGXdaNIV/CwLQQEc7fg5zzOc2vnaPjBKs OYbs7McL3NMmMy8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1n43xE-000JsH-6L; Sun, 02 Jan 2022 17:43:32 +0100 Date: Sun, 2 Jan 2022 17:43:32 +0100 From: Andrew Lunn To: Daniel Golle Cc: linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Fietkau , John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Jakub Kicinski , Matthias Brugger , Russell King , Michael Lee , Heiner Kallweit Subject: Re: [PATCH v10 1/3] net: ethernet: mtk_eth_soc: fix return value and refactor MDIO ops Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220102_084338_289194_77B474F5 X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > +static int _mtk_mdio_write(struct mtk_eth *eth, u32 phy_addr, u32 phy_reg, > + u32 write_data) > { > if (mtk_mdio_busy_wait(eth)) > - return -1; > - > - write_data &= 0xffff; > + return -EBUSY; -ETIMEDOUT would be more normal. I would probably also change mtk_mdio_busy_wait() so that it either returned 0, or -ETIMEDOUT. That is the general pattern in Linux, return 0 on success, or a negative error code. Returning -1 is an invitation for trouble. The code would then become ret = mtk_mdio_busy_wait(eth); if (ret < 0) return ret; which is a very common pattern in Linux. Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel