Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1248800img; Tue, 26 Feb 2019 17:33:03 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib793w1dyKgHyQl4FXB2+/qvXjudgeu1cqpcbTiPn20X1H0PJRRBIZXZeqcodNtkiBnOB4b X-Received: by 2002:a17:902:4c08:: with SMTP id a8mr21792993ple.294.1551231183719; Tue, 26 Feb 2019 17:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551231183; cv=none; d=google.com; s=arc-20160816; b=NB6R8m/5r8/kR8YFf8XMvoTTztTsPHf/zSei2DYiVjMx2+chimUPf5VsFjEZPk4SgH 4DGyp39n/OylrRPyfTkJFAwl7xgXTAF11HvLGLf6TW80Fc7/OtsDfcHmUa/idj2oRKfe Zv0O7aHPO+DjGGlJSOe5Li3eQKETvjA106hAH0kOHkYUD/b8PVPwkT+S8JlsgUwdMJWi 1DEE3JwBp3GGoX3Encu9RrlhTgb4ReXx/2MomORALzal7Gtyhri6b+YQMdbWdBnAZokY W7Mw7JwndkQ7dbLWHTrc4T/YRY5JE4X7dX9x2+ChkdDuSiDwlHtiYj0FlNP6+gqjoqL0 YQBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=3hvmuOtYMYt0aHFdzWWIFnb9WuzxaGLoOuap9tRVyMc=; b=ZsWJrOOtt6SsFOFhq6Wc0XyC1Qah8yuoLZxFRuA5GEEU/uGKqoI+mPUITGRq4oDmwV wBKYCH0VmCdGaWG1lGVDS1w2RirHTqs0Gwym1NmTs1dsiqr1283Xg79FfaIhxlFo2OTj HuPFN+r5zcvIOiLqbFLPdOC5ea7MtkqrVeQNEkrHkggUeq0Fho1UXsJoDxXHpXaN/MHG lQMbSUIVOU87QkNtftj39oe14hNJI1tXKFFu07o6Vv38mZMTl3kQAf4NzmsoV6GtFEV8 WCZOvsgId4+SNITzFClW+UxX0FHMPBNBPBRwySnTQNfMR9EbyPwijhsKj5oKrUkz5i9l BUsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=DvutV3Tc; 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 1si12119815ply.232.2019.02.26.17.32.48; Tue, 26 Feb 2019 17:33:03 -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; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=DvutV3Tc; 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 S1729488AbfB0BbI (ORCPT + 99 others); Tue, 26 Feb 2019 20:31:08 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46975 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729187AbfB0BbI (ORCPT ); Tue, 26 Feb 2019 20:31:08 -0500 Received: by mail-pg1-f195.google.com with SMTP id 196so7072820pgf.13 for ; Tue, 26 Feb 2019 17:31:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=3hvmuOtYMYt0aHFdzWWIFnb9WuzxaGLoOuap9tRVyMc=; b=DvutV3TcYqUPWFyS0Rf2jdS2QNGMYZvYPer8xGBggrKKz0ljEQePG6JKYG8RCXQ+hs XaffTlk18pjjuwsubK4mk4RwGCinsz0Vb/wP9pqculXfrX1aT9sdltYsDlEO9v7QC0vY GV4oN/pOSTMDWm8n7FZu3Ti3Iv+J4fVf3Vi3H2ToiK8BY2K22JPNTeLdRTUre8/ltuwP bAc9Ex5kmVwhRfeqWI7/mgPwbhQ2k6lucgtVvMgeyPOh32vwNehBhePnUqmW1vRe18lT /K2DhlqnuDNT2/gEx3/U0s4A2NdhZ7psRwcW8kFX2iG9ePHpo6gQl6vkdMhcILo+Uh/L wRRQ== 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; bh=3hvmuOtYMYt0aHFdzWWIFnb9WuzxaGLoOuap9tRVyMc=; b=Xmc4BVeEcrkePp8gowsNgpe76GBqfojkDcRHxGfBAwdL6SV7qjt5qFiE73LWsuFg4z ej9GplV4ZzBy0H8x6CvF5d7s48BdNVY8p6o6Py7srplPHUaX8s7jROF81/eAXqTRTxJG 0i76JDBPZ9W7QR6uEjMA1kdLHWseKW6MYsq63AyfORj8kAj8YkfNJYKHGGQf4A84G7fT scJnwzBSmvqAWivlPo/rW6qzXUiy9AmdxiMEtFrkJV/rPvi6UgMM6dKahupj77NB1oSx d/QHkEFHsfPSckUdh2zpIYAG0IGauwN4u+tzHtHFq/IN81aXWLMugI4GWMTinLQVVYjK 89EQ== X-Gm-Message-State: AHQUAuZJj0rPWFPwwKvYeB1GZyfIsJ6YdDw2pbwd1scyD5F+Ftbe8mgm DmpzVYbUTaEosMaeMrIf5Q6DaQ== X-Received: by 2002:a63:fa48:: with SMTP id g8mr402105pgk.203.1551231066941; Tue, 26 Feb 2019 17:31:06 -0800 (PST) Received: from localhost.localdomain (36-239-237-193.dynamic-ip.hinet.net. [36.239.237.193]) by smtp.gmail.com with ESMTPSA id y14sm22614831pgc.17.2019.02.26.17.31.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 17:31:06 -0800 (PST) From: Axel Lin To: Mark Brown Cc: Lee Jones , patches@opensource.cirrus.com, Liam Girdwood , linux-kernel@vger.kernel.org, Axel Lin Subject: [PATCH] regulator: wm8400: Get rid of wm8400_block_read/wm8400_set_bits functions Date: Wed, 27 Feb 2019 09:30:53 +0800 Message-Id: <20190227013053.9517-1-axel.lin@ingics.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only user of wm8400_block_read/wm8400_set_bits functions is the wm8400 regulator driver. At the context of all the callers, we can use regmap_bulk_read/regmap_update_bits directly. Thus remove wm8400_block_read/wm8400_set_bits functions. Signed-off-by: Axel Lin --- drivers/mfd/wm8400-core.c | 6 ------ drivers/regulator/wm8400-regulator.c | 17 ++++++++--------- include/linux/mfd/wm8400-private.h | 8 -------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c index 79756c83f5f0..cf067424a156 100644 --- a/drivers/mfd/wm8400-core.c +++ b/drivers/mfd/wm8400-core.c @@ -35,12 +35,6 @@ static bool wm8400_volatile(struct device *dev, unsigned int reg) } } -int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data) -{ - return regmap_bulk_read(wm8400->regmap, reg, data, count); -} -EXPORT_SYMBOL_GPL(wm8400_block_read); - static int wm8400_register_codec(struct wm8400 *wm8400) { const struct mfd_cell cell = { diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c index fb1837657b64..40c4e6628471 100644 --- a/drivers/regulator/wm8400-regulator.c +++ b/drivers/regulator/wm8400-regulator.c @@ -36,13 +36,12 @@ static const struct regulator_ops wm8400_ldo_ops = { static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev) { - struct wm8400 *wm8400 = rdev_get_drvdata(dev); + struct regmap *rmap = rdev_get_regmap(dev); int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2; u16 data[2]; int ret; - ret = wm8400_block_read(wm8400, WM8400_DCDC1_CONTROL_1 + offset, 2, - data); + ret = regmap_bulk_read(rmap, WM8400_DCDC1_CONTROL_1 + offset, data, 2); if (ret != 0) return 0; @@ -63,36 +62,36 @@ static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev) static int wm8400_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode) { - struct wm8400 *wm8400 = rdev_get_drvdata(dev); + struct regmap *rmap = rdev_get_regmap(dev); int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2; int ret; switch (mode) { case REGULATOR_MODE_FAST: /* Datasheet: active with force PWM */ - ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset, + ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset, WM8400_DC1_FRC_PWM, WM8400_DC1_FRC_PWM); if (ret != 0) return ret; - return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, + return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset, WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, WM8400_DC1_ACTIVE); case REGULATOR_MODE_NORMAL: /* Datasheet: active */ - ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset, + ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset, WM8400_DC1_FRC_PWM, 0); if (ret != 0) return ret; - return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, + return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset, WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, WM8400_DC1_ACTIVE); case REGULATOR_MODE_IDLE: /* Datasheet: standby */ - return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, + return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset, WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, 0); default: return -EINVAL; diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h index 4ee908f5b834..43d0d307e2e3 100644 --- a/include/linux/mfd/wm8400-private.h +++ b/include/linux/mfd/wm8400-private.h @@ -923,12 +923,4 @@ struct wm8400 { #define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */ #define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */ -int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data); - -static inline int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, - u16 mask, u16 val) -{ - return regmap_update_bits(wm8400->regmap, reg, mask, val); -} - #endif -- 2.17.1