Received: by 10.223.185.116 with SMTP id b49csp3624246wrg; Mon, 26 Feb 2018 03:19:21 -0800 (PST) X-Google-Smtp-Source: AH8x227R3q/X1MCC2RYTZtUm7RR2JqpDrXRYLzhHtYbJwQKelfHRvz+s7hiuCjYQFRq2sbIKCVc3 X-Received: by 2002:a17:902:6b48:: with SMTP id g8-v6mr10301206plt.151.1519643961267; Mon, 26 Feb 2018 03:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519643961; cv=none; d=google.com; s=arc-20160816; b=ZsOUxXEbyVKMNVechY9WLiOKZhlntSndZ6PXCeK1l2OzGw2yEdeZ2M7rMSzHQwWRfd cwlTctdt5DDTIh4kbaSYz/CC5IRLqZe4A0eE2njyOYt/LtN57Tcc9IiBXAQDFv2WAHfd AOyn14f/tTxjSLtkdngvVpHc+ZmU920c82KNfoSKos5k5s6ttPuGmCbQtvSTck7mHku6 BfRacNMtlwPHwF9YcrG4Uh5bAxWxeijOdtsEQ422pxEHHql9eL7b8Xf5jwGyMfdGwAxI xpsWSkRhrWo7ShHMU9gVSnjbRhQfww5QfGLHT56ctRNXaHy+lxSWFcbBmBbto2alFCfN fWJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=RuLKkZnbajjytOEe6/sZKZzN64xs/Lk6PecI5uii/pU=; b=im1Aq6AAJxxwRRAoxe7wgIUaes59aYQ8FNDBJYvNzMIf26Bl/l3Zd2+KtJOay2u00Q ZBTkpZqwg38DS4jEu4AFqeWbV2ug1LPXPhazc/ADdVnVP7SCZflYWqa/aHh3XRW04Zcj Pb61hWWn06JKl68qXATpiVTjVjN30bt5AL7qMunLW3BGQbI5ERvitFGiXvf7ain/DokV JJLSDemZNrhicuXj4V7FQY6zNRkOiU044qJjVWDcJ6b/EO3Bf4XfyPHOAzCtf1ziYnU6 Vd8a2AhYKZBPZxjLds3t5Odo2iJvvSfHLsauiKFooJoorhEnLbQY2CNeQUXdhLfwFNPL WSzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=w1YIGSBA; 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 v1-v6si1184742plb.281.2018.02.26.03.19.07; Mon, 26 Feb 2018 03:19:21 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=w1YIGSBA; 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 S1752828AbeBZLSA (ORCPT + 99 others); Mon, 26 Feb 2018 06:18:00 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:52040 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157AbeBZLR4 (ORCPT ); Mon, 26 Feb 2018 06:17:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=RuLKkZnbajjytOEe6/sZKZzN64xs/Lk6PecI5uii/pU=; b=w1YIGSBAn/qS caMsW3GFib1Agf+jf0ntwuB44CFKCK2dp4RObu+Fxf1m23ku/SL6LjBTjXg7j8nag0PyUwUxq59lG oTdAhZ28+zEaauVJAan0/zfyGYz0G7JYIN5gphD4yQJ6X1idoYh5KaELuu9/1hoGNbhvu8iGWrwqi RY+w4=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqGn3-0007wI-Bi; Mon, 26 Feb 2018 11:17:53 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1eqGn2-0005a1-TM; Mon, 26 Feb 2018 11:17:52 +0000 From: Mark Brown To: Charles Keepax Cc: Mark Brown , broonie@kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org Subject: Applied "regmap: Merge redundant handling in regmap_bulk_write" to the regmap tree In-Reply-To: <20180222125914.17016-5-ckeepax@opensource.cirrus.com> Message-Id: Date: Mon, 26 Feb 2018 11:17:52 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regmap: Merge redundant handling in regmap_bulk_write has been applied to the regmap tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From fb44f3cec35c6e71865012fa281ba6d4ff50a99a Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Thu, 22 Feb 2018 12:59:14 +0000 Subject: [PATCH] regmap: Merge redundant handling in regmap_bulk_write The handling for the first two cases in regmap_bulk_write is essentially identical. The first case is just a better implementation of the second, supporting 8 byte registers and doing the locking manually to avoid bouncing the lock for each register. Drop some redundant code by removing the second of these cases and allowing both situations to be handled by the same code. Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- drivers/base/regmap/regmap.c | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index bfdd66dd3766..fafee9251d65 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1965,17 +1965,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, return -EINVAL; /* - * Some devices don't support bulk write, for - * them we have a series of single write operations in the first two if - * blocks. - * - * The first if block is used for memory mapped io. It does not allow - * val_bytes of 3 for example. - * The second one is for busses that do not provide raw I/O. - * The third one is used for busses which do not have these limitations - * and can write arbitrary value lengths. + * Some devices don't support bulk write, for them we have a series of + * single write operations. */ - if (!map->bus) { + if (!map->bus || !map->format.parse_inplace) { map->lock(map->lock_arg); for (i = 0; i < val_count; i++) { unsigned int ival; @@ -2008,32 +2001,6 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, } out: map->unlock(map->lock_arg); - } else if (map->bus && !map->format.parse_inplace) { - const u8 *u8 = val; - const u16 *u16 = val; - const u32 *u32 = val; - unsigned int ival; - - for (i = 0; i < val_count; i++) { - switch (map->format.val_bytes) { - case 4: - ival = u32[i]; - break; - case 2: - ival = u16[i]; - break; - case 1: - ival = u8[i]; - break; - default: - return -EINVAL; - } - - ret = regmap_write(map, reg + regmap_get_offset(map, i), - ival); - if (ret) - return ret; - } } else { void *wval; -- 2.16.1