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: 5004121 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 73907BEEA6 for ; Tue, 30 Sep 2014 16:07:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B14782013A for ; Tue, 30 Sep 2014 16:07:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C766F2013D for ; Tue, 30 Sep 2014 16:07:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbaI3QHH (ORCPT ); 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: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;