Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2476830ybb; Sat, 21 Mar 2020 23:56:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vujC0f8H463W9M86XoGBVzDZpu4FxAaIK4AZ+8gtETweseSwMTSxQ9M/1KC5HpA3xPkX9xa X-Received: by 2002:a9d:6186:: with SMTP id g6mr13198324otk.236.1584860189858; Sat, 21 Mar 2020 23:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584860189; cv=none; d=google.com; s=arc-20160816; b=aDEi2zzSBW/N+z0toBlyhcrMye2xjJveO6GyDJUGk3JVRN7vMmVnMW8HHxiYbuEyO3 o4ppiJp1OIqQhgjcs7ocq1LTLKxIt3jHCDfAC2c+43RCiMqelpFR4re2FqogqBEoK6cP 5q3HJeI03Ci/BJMO5286G8Q+nZb2oCXW3qiSI5a6kkTVVbe5R8d0nSMbJzt8pD06DO3n sE9Q16UBYsYTwK2g1wohfwPYcR72KNR/Y1RJLO/gAR6phaGH6VPDs//UGFWOk2VdmUuw Y5FsOitFB/bdztoEAe0jtpGz7XjLQDVQpZgcZlKXo0BKVtMfZNrhEX7TAAQCPXRhqGIf /xHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OQqQn99Uv4ZIDhpnDOVOqhMEbWNDKQDeCC0lY1Dffgw=; b=CfAEJnIyO40gWF0WYCCw4AD24POixidMRfZ+sAbPSYSAi3OJsCfIiMjmVoxiXx8Pjr WGtAAAt5brx2tw9E8IQtTyLX38RX31tqzSBn+E8eXGxgrbHCqx8E0laQEuRunLkR6bOe 2Y9KkPuK8mFZ/RiuKQMDHrmcpInSNEy8+pk0Kgup0aKo7wv8DnZAAaIWwE0rWvkA4App 62xSF2+rXX4birzVShuIlCMhXBRZv3Q30xG18AbTnwMUPTKfEzaMe9S6Y3xl0L190hVL tBrRHBj3dpk7w6l0stbjU2FUHJHRGSS9f3t+TLmD6UuuCWhaBPaNEtDyVDhyhDSAgyE+ 46VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Tw8FZtzP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j184si5559108oih.216.2020.03.21.23.56.17; Sat, 21 Mar 2020 23:56:29 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Tw8FZtzP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726502AbgCVG4B (ORCPT + 99 others); Sun, 22 Mar 2020 02:56:01 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35485 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgCVG4B (ORCPT ); Sun, 22 Mar 2020 02:56:01 -0400 Received: by mail-pf1-f196.google.com with SMTP id u68so5758839pfb.2; Sat, 21 Mar 2020 23:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OQqQn99Uv4ZIDhpnDOVOqhMEbWNDKQDeCC0lY1Dffgw=; b=Tw8FZtzPIfeGhI19y21NNycSY1+7m1HuUSWAXa50RKIWvvz5hH8b9/FFQkqoJSoQzv hGfHZwjPy+bomjxwI4VYGapudLqwC3X7JWzXwTg6e947337ihCDnZCD9W+ZYe07Lnz5E CRIAa9LRmBscJv/6AuStSV/ryjuwMoUXvr11UnE9+jhH9Dop1VCjV4CTL+hs3Kz+wls3 ppReVWxbCNEPRoEqy1k1S6jd3NS1HLzPCsjXdvKJgKFdnzUnMWmvCqQoF+24AsdzCiSH MD+7vrIKW3vZXxpTevE8F5vZDe05eUfhiKMUkV/ZFQmexKEVpSOf0Kjvp/jAPcNmMGJg GD2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OQqQn99Uv4ZIDhpnDOVOqhMEbWNDKQDeCC0lY1Dffgw=; b=Y/KOMWudDFCD/a19m2GCsemO1YKimngnDKOEv0To+SHjqpLRx4Ol0LOknDt5/gzCuq s5LLBC2JJjlVFikjZEZab9dKD904AG/xbjz8nb86jE3TyANpnQSOfp7dEkSGc/LraFRW PlwFFifunj2ktrChf0v21GQcDJL6LgzlaklpynOHQBRA5TPr3sG+BLhjeA67kEn88sNL mr5h1gJSZXDi+9PqHXH8LF3fjd0+QO1YD1VU+yCg+EfwLyDEQWqcUTLMmQmUwieaUP6g n4povGpirwuMJOcjZfpBps+aMkKENCtWAkyFHuE2NVFYk0F8Us5T6uw+bczVMQU8AGqS 8VYg== X-Gm-Message-State: ANhLgQ3Vk55KP7eCn1q7ASzJMzHX6umSCsQYpwkzaJqO3XJCpawcnGUZ A6TCQ10/l2XvJ594RKMLBtg= X-Received: by 2002:a63:a361:: with SMTP id v33mr16064714pgn.324.1584860160370; Sat, 21 Mar 2020 23:56:00 -0700 (PDT) Received: from localhost (216.24.188.11.16clouds.com. [216.24.188.11]) by smtp.gmail.com with ESMTPSA id z132sm7115311pgz.45.2020.03.21.23.55.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Mar 2020 23:55:59 -0700 (PDT) From: Dejin Zheng To: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, gregkh@linuxfoundation.org, broonie@kernel.org, alexios.zavras@intel.com, tglx@linutronix.de, mchehab+samsung@kernel.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH net-next v4 0/9] introduce read_poll_timeout Date: Sun, 22 Mar 2020 14:55:46 +0800 Message-Id: <20200322065555.17742-1-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch sets is introduce read_poll_timeout macro, it is an extension of readx_poll_timeout macro. the accessor function op just supports only one parameter in the readx_poll_timeout macro, but this macro can supports multiple variable parameters for it. so functions like phy_read(struct phy_device *phydev, u32 regnum) and phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum) can use this poll timeout framework. the first patch introduce read_poll_timeout macro, and the second patch redefined readx_poll_timeout macro by read_poll_timeout(), and the other patches are examples using read_poll_timeout macro. v3 -> v4: - add 3 examples of using new functions. - deal with precedence issues for parameter cond. - drop a patch about phy_poll_reset() function. v2 -> v3: - modify the parameter order of newly added functions. phy_read_mmd_poll_timeout(val, cond, sleep_us, timeout_us, \ phydev, devaddr, regnum) || \/ phy_read_mmd_poll_timeout(phydev, devaddr regnum, val, cond, \ sleep_us, timeout_us) phy_read_poll_timeout(val, cond, sleep_us, timeout_us, \ phydev, regnum) || \/ phy_read_poll_timeout(phydev, regnum, val, cond, sleep_us, \ timeout_us) v1 -> v2: - passed a phydev, device address and a reg to replace args... parameter in phy_read_mmd_poll_timeout() by Andrew Lunn 's suggestion in patch 3. Andrew Lunn , Thanks very much for your help! - also in patch 3, handle phy_read_mmd return an error(the return value < 0) in phy_read_mmd_poll_timeout(). Thanks Andrew again. - in patch 6, pass a phydev and a reg to replace args... parameter in phy_read_poll_timeout(), and also handle the phy_read() function's return error. Dejin Zheng (9): iopoll: introduce read_poll_timeout macro iopoll: redefined readx_poll_timeout macro to simplify the code net: phy: introduce phy_read_mmd_poll_timeout macro net: phy: bcm84881: use phy_read_mmd_poll_timeout() to simplify the code net: phy: aquantia: use phy_read_mmd_poll_timeout() to simplify the code net: phy: marvell10g: use phy_read_mmd_poll_timeout() to simplify the code net: phy: introduce phy_read_poll_timeout macro net: phy: smsc: use phy_read_poll_timeout() to simplify the code net: phy: tja11xx: use phy_read_poll_timeout() to simplify the code drivers/net/phy/aquantia_main.c | 13 ++++-------- drivers/net/phy/bcm84881.c | 27 ++++--------------------- drivers/net/phy/marvell10g.c | 15 +++++--------- drivers/net/phy/nxp-tja11xx.c | 16 +++------------ drivers/net/phy/smsc.c | 16 +++++---------- include/linux/iopoll.h | 36 ++++++++++++++++++++++++++------- include/linux/phy.h | 28 +++++++++++++++++++++++++ 7 files changed, 78 insertions(+), 73 deletions(-) -- 2.25.0