From patchwork Tue Sep 30 16:07:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 38163 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E339A20549 for ; Tue, 30 Sep 2014 16:07:12 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id d1sf1565457wiv.6 for ; Tue, 30 Sep 2014 09:07:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=I6b47c23nCQUFzcXOx2LiPSVz194IVdXtPwURafpwbo=; b=WXBW3E3YrXvEeVR9VA0MNNb5OxlGugurhwGiC4YPo3NPZOOe97e6x6rBTOx3nyqTcj /41Uwbj21HH9uvS7Kdo0iD4vRAtls+O/Yjek4eiGOYAMmaubte7CgEP/ZHG1H0IoKePu isl1+qKXHzNREf1SGjFTK65eu+0oMNYu9Od5608reGfdDEgW1P16UTFQwEosYHgqvcqZ Me2OrxQhygslnbeFqTzxlU/5KbZKMQbY9iK3PPFMheqvqbpz2/UUOJXI/wuFydmT4K7e ukB1znTyZXhthFCTSWZLWeS43d859SESFAPX4ScFeUgok9TwSo8hnVhMqm9Lzn2iAizh 6OAQ== X-Gm-Message-State: ALoCoQksu91GEtsIycQDn/JzdWlmxRlUc1G4MGWyTOPj3Eti12TIyNWAIxtXWDbjUculPLxiHyEz X-Received: by 10.152.23.166 with SMTP id n6mr217241laf.9.1412093231203; Tue, 30 Sep 2014 09:07:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.169 with SMTP id s9ls54770laa.47.gmail; Tue, 30 Sep 2014 09:07:10 -0700 (PDT) X-Received: by 10.112.161.70 with SMTP id xq6mr46313568lbb.49.1412093230896; Tue, 30 Sep 2014 09:07:10 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id 4si3402061lbk.22.2014.09.30.09.07.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 09:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id s18so5032144lam.9 for ; Tue, 30 Sep 2014 09:07:10 -0700 (PDT) X-Received: by 10.112.130.226 with SMTP id oh2mr11483834lbb.100.1412093229966; Tue, 30 Sep 2014 09:07:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp376841lbb; Tue, 30 Sep 2014 09:07:09 -0700 (PDT) X-Received: by 10.70.55.232 with SMTP id v8mr67518148pdp.93.1412093228487; Tue, 30 Sep 2014 09:07:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si26432147pdf.63.2014.09.30.09.07.07 for ; Tue, 30 Sep 2014 09:07:08 -0700 (PDT) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbaI3QHH (ORCPT + 5 others); Tue, 30 Sep 2014 12:07:07 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:52277 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbaI3QHG (ORCPT ); Tue, 30 Sep 2014 12:07:06 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8UG72nk028519; Tue, 30 Sep 2014 11:07:02 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8UG72hW004945; Tue, 30 Sep 2014 11:07:02 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Tue, 30 Sep 2014 11:07:02 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8UG72gV002379; Tue, 30 Sep 2014 11:07:02 -0500 Received: from localhost (j-172-22-139-203.vpn.ti.com [172.22.139.203]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s8UG71t16458; Tue, 30 Sep 2014 11:07:01 -0500 (CDT) From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH] regmap: Allow read_reg_mask to be 0 Date: Tue, 30 Sep 2014 11:07:00 -0500 Message-ID: <1412093220-24690-1-git-send-email-dmurphy@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dmurphy@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There may be spi devices that do not require a register read mask to read the registers. Currently the code sets the read mask based on a non-zero value passed in from the driver or if that value is 0 sets the read mask to 0x80. A mask of 0 is a valid mask as well. Create a define to indicate that the read mask can be zero and separate out the read flag mask and the write flag mask. Signed-off-by: Dan Murphy --- drivers/base/regmap/regmap.c | 11 +++++++---- include/linux/regmap.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 78f43fb..8c0a9b8 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -528,12 +528,15 @@ struct regmap *regmap_init(struct device *dev, INIT_LIST_HEAD(&map->async_free); init_waitqueue_head(&map->async_waitq); - if (config->read_flag_mask || config->write_flag_mask) { + if (config->read_flag_mask == REGMAP_NO_READ_MASK) + map->read_flag_mask = 0x00; + else if (config->read_flag_mask) map->read_flag_mask = config->read_flag_mask; - map->write_flag_mask = config->write_flag_mask; - } else if (bus) { + else if (bus) map->read_flag_mask = bus->read_flag_mask; - } + + if (config->write_flag_mask) + map->write_flag_mask = config->write_flag_mask; if (!bus) { map->reg_read = config->reg_read; diff --git a/include/linux/regmap.h b/include/linux/regmap.h index c5ed83f..f1cdfe5 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -18,6 +18,8 @@ #include #include +#define REGMAP_NO_READ_MASK 0xff + struct module; struct device; struct i2c_client;