Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2919591ybb; Sun, 22 Mar 2020 10:50:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs+i+t9czTQZrzogv6eWnI9OVICvwMca9MEjhbi8OZWlipjoDPSdNGlXTs7c9wwAn1+tt1i X-Received: by 2002:a9d:6750:: with SMTP id w16mr9990960otm.220.1584899435596; Sun, 22 Mar 2020 10:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584899435; cv=none; d=google.com; s=arc-20160816; b=biNS2kVId1pldU18m6ToPG8/5kU8UpTkoazujVnVJyxlqi8xkFUIiA9lREbSraBJqO DRCLEBv3SMBFdGZJQ2UZ0rAM6FqYGJCAJgFs58dXayQSP2esEgrDqGA23SKfdAG9B4pE e0aZ1Tid+a5h1dLnvLJaiwjMQFBe0aN+IQcpHaO5stGnaIXiTsDTT0ZIVV1dq22C9uJD dlRhY7/Xg5PpyQE7xlYnmihC68IZr2C2AkE0HYaA36CZTmDTXvFvdtpuRUL/vyeQ4pb9 PU5kagZWDz0znE2GgdpEzHSgZV6GjnpAnlwCGycJ3LBBdTKm5HpfrJEd2/vczA6X5wPu e+9Q== 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=eBI1fOyFAnh9kYunzCXwVSyGJl58uc4POnZ1ZNbJnhI=; b=iiWqed/bnMFtDhAr7/uqCbBqecfkS44sgPc10mYD+OpsmAhAZmi4kpl3jFgoKPS/65 Lt45Z36y8wAjE3y2VTWFb4FPdNb/JDmmI5pdnr0a6K7hxpKXhcdj6zmeuQEyWxk0631H feaN0rNkSJ1+QHlW9rvL10q+9I1jMm/3zW8QoCpCy1KJh+Nz/gOpmSY0Tn93vanz6+ZV 3VYALFMu5Av1TNbFGNsq3d4FH7xaogKCWvEwMoVVpFrUCMa3qNH6Np8fKlTogOmAFK6p TObDMNk7dlAc+bn6yXAVFD+HPVka/05pZklCXVgxlqO2SuYm/7duqpc1i1chR6u00jxl pOzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HWbNwU4b; 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 v20si5983250oif.63.2020.03.22.10.50.23; Sun, 22 Mar 2020 10:50:35 -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=HWbNwU4b; 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 S1726945AbgCVRty (ORCPT + 99 others); Sun, 22 Mar 2020 13:49:54 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38005 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbgCVRtx (ORCPT ); Sun, 22 Mar 2020 13:49:53 -0400 Received: by mail-pl1-f196.google.com with SMTP id w3so4863886plz.5; Sun, 22 Mar 2020 10:49:51 -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=eBI1fOyFAnh9kYunzCXwVSyGJl58uc4POnZ1ZNbJnhI=; b=HWbNwU4beCX3e6YY3C3JucuQ0Lf1/KuM7c2PM+v6sPA//MlFTMHYP7fByddN78jS0o 7uNscZPdT61JQLjJVsPmFedAEGxOqjCWnj5ENKsfRFUnrEwbutCOMhR+xPlJUfvdo6/P 9xozdPXPdrxWa7h+6iN28CNNgAH0o7qSr0BUhQk332P/JRj5WhwMe5FAbfAuHVlJdvKN 4G3DuEbmXzKVG/FRKif2JhrjHFNBQLrvnlle9LttE1EAWCB5aQsLuHO8DhaNkFUz00Om 5pcqwjYWcmI96XDe6joDNmPdtbFxz9oaGcHI9P9uTiVNlP0U/eUmNU4y9TqEY3Lq4kxz To2w== 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=eBI1fOyFAnh9kYunzCXwVSyGJl58uc4POnZ1ZNbJnhI=; b=TGV8erUImv0vm2XyYLZLdj5zkoq0IueubvwhTrCT2cOhhK4r5dbqKcUjkb5XGbESuj 0Tk7iY5/RKboBXZYPOavtcjAQAjq+tK/B/ie8xhICwI8ec0ylNy2e3qCvi6eSRLnoQOD ZVz5e6KAESeek9oBG2zAPu3AcnE/jfM65OfzLVwtOVDmV9R1RDbohIkL14N7db9p/wBP bmr8qy/faHxMtukRoaZkuSj8MHc2bHKWnGAR2UKhfatbZ8QSlG0kLmF7ox0R5Rzb/aCB GoWjl9phjpL7N9njPcfhwL5tCCgAxOC9LwlD0m8dsju//B+Jslg0Zn03XFRXmry9DHKW 0eLg== X-Gm-Message-State: ANhLgQ0XQSmLp/HRBy2mKWNiGKGeWuZ3l8qLsPMmwDSCN6EPcWg3/TPX XoneWo259h5DvK6bXKArTWk= X-Received: by 2002:a17:90a:a40f:: with SMTP id y15mr21922925pjp.143.1584899390870; Sun, 22 Mar 2020 10:49:50 -0700 (PDT) Received: from localhost ([216.24.188.11]) by smtp.gmail.com with ESMTPSA id a3sm10965055pfg.172.2020.03.22.10.49.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Mar 2020 10:49:50 -0700 (PDT) From: Dejin Zheng To: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, mchehab+samsung@kernel.org, corbet@lwn.net, gregkh@linuxfoundation.org, broonie@kernel.org, tglx@linutronix.de, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH net-next v5 00/10] introduce read_poll_timeout Date: Mon, 23 Mar 2020 01:49:33 +0800 Message-Id: <20200322174943.26332-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. v4 -> v5: - add some msleep() before call phy_read_mmd_poll_timeout() to keep the code more similar in patch 6 and patch 9. - add a patch of drop by v4, it can add msleep before call phy_read_poll_timeout() to keep the code more similar. 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 (10): 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: use phy_read_poll_timeout() to simplify the code 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 | 16 ++++++--------- drivers/net/phy/nxp-tja11xx.c | 16 +++------------ drivers/net/phy/phy_device.c | 17 +++++----------- drivers/net/phy/smsc.c | 17 ++++++---------- include/linux/iopoll.h | 36 ++++++++++++++++++++++++++------- include/linux/phy.h | 28 +++++++++++++++++++++++++ 8 files changed, 85 insertions(+), 85 deletions(-) -- 2.25.0