From patchwork Wed Jun 15 05:59:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 635711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pf0-x23b.google.com (mail-pf0-x23b.google.com [IPv6:2607:f8b0:400e:c00::23b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rTwpj3Ng9z9t1m for ; Wed, 15 Jun 2016 16:00:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b=QD6rO/rV; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=jMC85CVT; dkim-atps=neutral Received: by mail-pf0-x23b.google.com with SMTP id g62sf4362819pfb.1 for ; Tue, 14 Jun 2016 23:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=mp2a5+gv+mOTyZvsLKl2IUNu4WPxxE+zatLBicVP9bM=; b=QD6rO/rV+i7rXwy/Y+0PuLoM/eY3BNv5s1ShVPhkU28rzx3RFqWhMc4v3MJbO0lo8l MId9uSfxB4jzIGI8HSZocleWXYAzkXC07+ctaOImtBPEhspBBWx7ZNHUcD2Gk4rOSFFT SqO9Qc4IjX/byTyD+iQDjl62YyX+mAx3qCEPQDgy4v6sjWZ45eRkeW4NdnwmmHYp0KVt zpMHYWVCUzZaQ+iesXEMEzLpQc+I0qEkhj8GbsoxelFCRB6XbLdTYD9V9A8+LOAy8xZ0 eSr9ki+svVdbylOq63Jn7Q//toK2mt5c/KKDz4UTc+OUXj5oEzjCp6j9vPIMpyJW38Zo aH5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=mp2a5+gv+mOTyZvsLKl2IUNu4WPxxE+zatLBicVP9bM=; b=jMC85CVT4upW8vh2z7vP8IOBx3IuoTpXMXfnSIr2FqPs/Oh5uolEc12+JD/Ys3DjWY ZZdQaFVWjUUDYXc9cUWRsQOds7FKlKud2vZ02d7y9baVdvzfI4iSRf9CL8X2uGYWS0MU jrW7U8x+M7493yPVGMgVK4r44pxtrCKvzzf+4MZ0uCNB8tZGmwtUiV7KeK2ROdhKx6xx 2CZ+yn++XgzeaO69ByEuWnERnj6VXHqsj5gKWfrRxGe0vNhYBQ0swDPETvRI2qdDO9Xl CR+/3/3ae0kwK72zCQWSKD61uIz0tiQxak5CH8w8hvle47P1MlY2sKyEjHyIoUhBmCrJ AIyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=mp2a5+gv+mOTyZvsLKl2IUNu4WPxxE+zatLBicVP9bM=; b=P7QvKxnai2kU7Z9JiRkzPPc2uNt1vssxoO7IQ7lcvEAwc6gSuvyeceS2DmVP4AaTM2 ypbtyvAOyaIn113QvIkPHyMea5+PVgzQuwESVyRLGdV8x5JNvlcB3ilqGU3RqShW8b0V p3bdrwkIR6HyqvP4S2ciPzz6uzAt2eOv1JLIbVHEmAqMJyfEXy+JBAqfJ1RcQZl1LRSa yv6gkwYYqqNP4eg9gkMjRnUwY8+Ey88SCpkb3R49858QX7zfCYjMkeWxz3abKGrLxkWk u/8U4l1ogiHCdr5v1Y4oCyZt5JDneaHXnRv3BvANYxjrrSp7XsC1Edkou7NAAOGs0MIg f3NA== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: ALyK8tKIeaWLhaaeRbxlYW7lix/BCECwbatR/q7fCN6zo22xI/XNsovbxwFaNMMUYmSBKg== X-Received: by 10.140.100.149 with SMTP id s21mr888744qge.3.1465970412113; Tue, 14 Jun 2016 23:00:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.140.22.38 with SMTP id 35ls355561qgm.98.gmail; Tue, 14 Jun 2016 23:00:11 -0700 (PDT) X-Received: by 10.140.203.134 with SMTP id y128mr7576614qha.5.1465970411876; Tue, 14 Jun 2016 23:00:11 -0700 (PDT) Received: from mail-pa0-x242.google.com (mail-pa0-x242.google.com. [2607:f8b0:400e:c03::242]) by gmr-mx.google.com with ESMTPS id 62si3601890pfx.1.2016.06.14.23.00.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jun 2016 23:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of andrew.smirnov@gmail.com designates 2607:f8b0:400e:c03::242 as permitted sender) client-ip=2607:f8b0:400e:c03::242; Received: by mail-pa0-x242.google.com with SMTP id hf6so794121pac.2 for ; Tue, 14 Jun 2016 23:00:11 -0700 (PDT) X-Received: by 10.66.231.68 with SMTP id te4mr1998993pac.16.1465970411549; Tue, 14 Jun 2016 23:00:11 -0700 (PDT) Received: from squirtle.localdomain.localdomain (c-73-225-163-254.hsd1.wa.comcast.net. [73.225.163.254]) by smtp.gmail.com with ESMTPSA id h189sm10432824pfc.52.2016.06.14.23.00.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jun 2016 23:00:11 -0700 (PDT) From: Andrey Smirnov To: rtc-linux@googlegroups.com Cc: Alessandro Zummo , Alexandre Belloni , linux-kernel@vger.kernel.org, Andrey Smirnov Subject: [rtc-linux] [PATCH 09/13] RTC: ds1307: Constify struct ds1307 where possible Date: Tue, 14 Jun 2016 22:59:35 -0700 Message-Id: <1465970379-14703-10-git-send-email-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465970379-14703-1-git-send-email-andrew.smirnov@gmail.com> References: <1465970379-14703-1-git-send-email-andrew.smirnov@gmail.com> X-Original-Sender: andrew.smirnov@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com; spf=pass (google.com: domain of andrew.smirnov@gmail.com designates 2607:f8b0:400e:c03::242 as permitted sender) smtp.mailfrom=andrew.smirnov@gmail.com; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Signed-off-by: Andrey Smirnov --- drivers/rtc/rtc-ds1307.c | 50 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 3c137ab..dbf8361 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -333,7 +333,7 @@ static s32 ds1307_native_smbus_read_block_data(const struct i2c_client *client, static irqreturn_t ds1307_irq(int irq, void *dev_id) { struct i2c_client *client = dev_id; - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); struct mutex *lock = &ds1307->rtc->ops_lock; int stat, control; @@ -367,8 +367,8 @@ out: static int ds1307_get_time(struct device *dev, struct rtc_time *t) { u8 regs[DS1307_REG_COUNT]; - struct ds1307 *ds1307 = dev_get_drvdata(dev); int tmp; + const struct ds1307 *ds1307 = dev_get_drvdata(dev); /* read the RTC date and time registers all at once */ tmp = ds1307->read_block_data(ds1307->client, @@ -404,7 +404,7 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t) static int ds1307_set_time(struct device *dev, struct rtc_time *t) { - struct ds1307 *ds1307 = dev_get_drvdata(dev); + const struct ds1307 *ds1307 = dev_get_drvdata(dev); int result; int tmp; u8 regs[DS1307_REG_COUNT]; @@ -464,7 +464,7 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) { struct i2c_client *client = to_i2c_client(dev); - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); int ret; u8 regs[DS1307_REG_COUNT]; @@ -512,7 +512,7 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) { struct i2c_client *client = to_i2c_client(dev); - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); u8 regs[DS1307_REG_COUNT]; u8 control, status; int ret; @@ -574,7 +574,7 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) static int ds1307_alarm_irq_enable(struct device *dev, unsigned int enabled) { struct i2c_client *client = to_i2c_client(dev); - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); int ret; if (!test_bit(HAS_ALARM, &ds1307->flags)) @@ -629,7 +629,7 @@ static const struct rtc_class_ops ds13xx_rtc_ops = { static irqreturn_t mcp794xx_irq(int irq, void *dev_id) { struct i2c_client *client = dev_id; - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); struct mutex *lock = &ds1307->rtc->ops_lock; int reg, ret; @@ -666,7 +666,7 @@ out: static int mcp794xx_read_alarm(struct device *dev, struct rtc_wkalrm *t) { struct i2c_client *client = to_i2c_client(dev); - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); u8 regs[DS1307_REG_COUNT]; int ret; @@ -705,7 +705,7 @@ static int mcp794xx_read_alarm(struct device *dev, struct rtc_wkalrm *t) static int mcp794xx_set_alarm(struct device *dev, struct rtc_wkalrm *t) { struct i2c_client *client = to_i2c_client(dev); - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); u8 regs[DS1307_REG_COUNT]; int ret; @@ -751,7 +751,7 @@ static int mcp794xx_set_alarm(struct device *dev, struct rtc_wkalrm *t) static int mcp794xx_alarm_irq_enable(struct device *dev, unsigned int enabled) { struct i2c_client *client = to_i2c_client(dev); - struct ds1307 *ds1307 = i2c_get_clientdata(client); + const struct ds1307 *ds1307 = i2c_get_clientdata(client); int reg; if (!test_bit(HAS_ALARM, &ds1307->flags)) @@ -785,7 +785,7 @@ ds1307_nvram_read(struct file *filp, struct kobject *kobj, char *buf, loff_t off, size_t count) { struct i2c_client *client; - struct ds1307 *ds1307; + const struct ds1307 *ds1307; int result; client = kobj_to_i2c_client(kobj); @@ -804,7 +804,7 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj, char *buf, loff_t off, size_t count) { struct i2c_client *client; - struct ds1307 *ds1307; + const struct ds1307 *ds1307; int result; client = kobj_to_i2c_client(kobj); @@ -880,7 +880,7 @@ out: */ static int ds3231_hwmon_read_temp(struct device *dev, s32 *mC) { - struct ds1307 *ds1307 = dev_get_drvdata(dev); + const struct ds1307 *ds1307 = dev_get_drvdata(dev); u8 temp_buf[2]; s16 temp; int ret; @@ -973,7 +973,7 @@ static int ds3231_clk_sqw_rates[] = { 8192, }; -static int ds1337_write_control(struct ds1307 *ds1307, u8 mask, u8 value) +static int ds1337_write_control(const struct ds1307 *ds1307, u8 mask, u8 value) { struct i2c_client *client = ds1307->client; struct mutex *lock = &ds1307->rtc->ops_lock; @@ -1001,7 +1001,7 @@ out: static unsigned long ds3231_clk_sqw_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { - struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); int control; int rate_sel = 0; @@ -1032,7 +1032,7 @@ static long ds3231_clk_sqw_round_rate(struct clk_hw *hw, unsigned long rate, static int ds3231_clk_sqw_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); int control = 0; int rate_sel; @@ -1056,21 +1056,21 @@ static int ds3231_clk_sqw_set_rate(struct clk_hw *hw, unsigned long rate, static int ds3231_clk_sqw_prepare(struct clk_hw *hw) { - struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); return ds1337_write_control(ds1307, DS1337_BIT_INTCN, 0); } static void ds3231_clk_sqw_unprepare(struct clk_hw *hw) { - struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); ds1337_write_control(ds1307, DS1337_BIT_INTCN, DS1337_BIT_INTCN); } static int ds3231_clk_sqw_is_prepared(struct clk_hw *hw) { - struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_sqw_to_ds1307(hw); int control; control = i2c_smbus_read_byte_data(ds1307->client, DS1337_REG_CONTROL); @@ -1095,7 +1095,7 @@ static unsigned long ds3231_clk_32khz_recalc_rate(struct clk_hw *hw, return 32768; } -static int ds3231_clk_32khz_control(struct ds1307 *ds1307, bool enable) +static int ds3231_clk_32khz_control(const struct ds1307 *ds1307, bool enable) { struct i2c_client *client = ds1307->client; struct mutex *lock = &ds1307->rtc->ops_lock; @@ -1124,21 +1124,21 @@ out: static int ds3231_clk_32khz_prepare(struct clk_hw *hw) { - struct ds1307 *ds1307 = clk_32khz_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_32khz_to_ds1307(hw); return ds3231_clk_32khz_control(ds1307, true); } static void ds3231_clk_32khz_unprepare(struct clk_hw *hw) { - struct ds1307 *ds1307 = clk_32khz_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_32khz_to_ds1307(hw); ds3231_clk_32khz_control(ds1307, false); } static int ds3231_clk_32khz_is_prepared(struct clk_hw *hw) { - struct ds1307 *ds1307 = clk_32khz_to_ds1307(hw); + const struct ds1307 *ds1307 = clk_32khz_to_ds1307(hw); int status; status = i2c_smbus_read_byte_data(ds1307->client, DS1337_REG_STATUS); @@ -1273,7 +1273,7 @@ static bool ds1307_want_irq(const struct ds1307 *ds1307, return false; } -static int ds1307_chip_configure(struct ds1307 *ds1307) +static int ds1307_chip_configure(const struct ds1307 *ds1307) { int tmp; u8 regs[DS1307_REG_COUNT]; @@ -1422,7 +1422,7 @@ static int ds1307_chip_configure(struct ds1307 *ds1307) return 0; } -static int ds1307_chip_sanity_check(struct ds1307 *ds1307) +static int ds1307_chip_sanity_check(const struct ds1307 *ds1307) { int tmp; u8 regs[DS1307_REG_COUNT];