{"id":638511,"url":"http://patchwork.ozlabs.org/api/patches/638511/?format=json","web_url":"http://patchwork.ozlabs.org/project/rtc-linux/patch/1466493770-11895-4-git-send-email-andrew.smirnov@gmail.com/","project":{"id":9,"url":"http://patchwork.ozlabs.org/api/projects/9/?format=json","name":"Linux RTC development","link_name":"rtc-linux","list_id":"linux-rtc.vger.kernel.org","list_email":"linux-rtc@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1466493770-11895-4-git-send-email-andrew.smirnov@gmail.com>","list_archive_url":null,"date":"2016-06-21T07:22:38","name":"[v2,05/17] RTC: ds1307: Convert ds1307_can_wakeup_device into a predicate","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"7aed23e3903ada7881e244d2e7b5d7a1351391e0","submitter":{"id":67013,"url":"http://patchwork.ozlabs.org/api/people/67013/?format=json","name":"Andrey Smirnov","email":"andrew.smirnov@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/rtc-linux/patch/1466493770-11895-4-git-send-email-andrew.smirnov@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/638511/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/638511/checks/","tags":{},"related":[],"headers":{"Return-Path":"<rtc-linux+bncBDKOBWPM5ABRBV6WUO5QKGQE2F6V34Q@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Received":["from mail-yw0-x23a.google.com (mail-yw0-x23a.google.com\n\t[IPv6:2607:f8b0:4002:c05::23a])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rYfMY1ZjRz9t0V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 21 Jun 2016 17:23:05 +1000 (AEST)","by mail-yw0-x23a.google.com with SMTP id b72sf2199641ywa.0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 21 Jun 2016 00:23:05 -0700 (PDT)","by 10.157.46.83 with SMTP id c19ls3435660otd.14.gmail; Tue, 21 Jun\n\t2016 00:23:03 -0700 (PDT)","from mail-pf0-x242.google.com (mail-pf0-x242.google.com.\n\t[2607:f8b0:400e:c00::242]) by gmr-mx.google.com with ESMTPS id\n\tpo17si907888pab.2.2016.06.21.00.23.03\n\tfor <rtc-linux@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 21 Jun 2016 00:23:03 -0700 (PDT)","by mail-pf0-x242.google.com with SMTP id c74so763755pfb.0\n\tfor <rtc-linux@googlegroups.com>;\n\tTue, 21 Jun 2016 00:23:03 -0700 (PDT)","from squirtle.localdomain.localdomain\n\t(c-73-225-163-254.hsd1.wa.comcast.net. [73.225.163.254])\n\tby smtp.gmail.com with ESMTPSA id\n\tp187sm19452396pfg.67.2016.06.21.00.23.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 21 Jun 2016 00:23:02 -0700 (PDT)"],"Authentication-Results":"ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=dkeYgVBE; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=D9Tjb4jb;\n\tdkim-atps=neutral","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20120806;\n\th=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:x-original-sender:x-original-authentication-results\n\t:reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group\n\t:list-post:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=JplUb8O3A2dnM6Xo0cYFCFC5+6m+59IQfCLR7HqJuEM=;\n\tb=dkeYgVBE4aoGkC4b429yr1mnsj2eBMKgFjFwU/S7tRiqMflvcfjNgVFkQMpGPwYbxx\n\tS/7mMVGIXUDTBByQMVzntPlt0WOPWano/FQTtXJmRg+HHAOLakmXxm+iQ+XW7TWT+D1u\n\tQwnSzhGPpdsQ5q+9igU5Kli7ERDijJ13NUZfVl6/SzFaaWCOHkQgMvAwOr3+8oxJbX7L\n\t0Dkal+DagC/DVQIg+S8xad3EwcuS2ogXInBHxsA+bUWAIQVNV9ROzv6cQg9kCD7idvZU\n\tXRD8rJNH7nLvrDLVY3eHPq6XK6qRuEgcvKFuW/A8r+HBJFKhK7+yqQil3RU9ei3Vgw9y\n\txr4Q==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20120113;\n\th=mime-version:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:x-original-sender:x-original-authentication-results\n\t:reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group\n\t:list-post:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=JplUb8O3A2dnM6Xo0cYFCFC5+6m+59IQfCLR7HqJuEM=;\n\tb=D9Tjb4jbOd91+HDbQBdp4sWEDvJH6c/FdTO6cND97/dGEOxMns0djEFoDj4abxdF7i\n\tTZEx75BXINTjrC2cqIVemx9UhmONu9xOiS6k36cWXN6NSeCG2iG1zPNYQkn+FD58sPR3\n\tdeYR6K12QG3kLiS6o0f4WzQToM+Cf5pdCbaMbDlx+rVc3J5dVRdM44/oATuB3Eaq5w/q\n\tRXyoK+GSXEOCA0kAAtFlylvT7bfjMgDm0kRJlHXaEwV48XyB9RUd4AB/6v+RFkvTiviY\n\tvKMzkW+QyPyyvTsuTZbYYOXQYb8hVb5AGWAq/z+jDnaFspVw6IwJrnKOrsOS0hBZhVDc\n\t+90g=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=sender:x-gm-message-state:mime-version:from:to:cc:subject:date\n\t:message-id:in-reply-to:references:x-original-sender\n\t:x-original-authentication-results:reply-to:precedence:mailing-list\n\t:list-id:x-spam-checked-in-group:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=JplUb8O3A2dnM6Xo0cYFCFC5+6m+59IQfCLR7HqJuEM=;\n\tb=TqcdAFPjmKcr6IbOHIyVl8PqXxGoomde8BKQPW90Pq2t7WjJScj/W4wS21rX8pyiN0\n\tIcuvr0nMp0vF/Dudxw92hw40zd9+KTS96YSiaTPam4R0W9UipYxeW1YQVdW80Vd1tO26\n\tqAxcpq/VD9Qaa/GopOBoEWdRFLwzhJZKSc1gx0SlWaaytUg48d7wWf82TEvWYEnT+b6X\n\txE3FEfb/pEjDEt2nu4sKQ32s0i9PfmtdBsOZzbcS8HVQCmWA1rhe+OuIluPV7f7XjXFi\n\tiMqfRbgj6fH4Mk41az8dTH/zo5uieccnm3v878mTUGfryYxlIOgSypZgIwmd6XVExIKd\n\tS6Lg==","Sender":"rtc-linux@googlegroups.com","X-Gm-Message-State":"ALyK8tIJfu18YsOmMdMvDT6mWNG+RdgjVpfWvYPNix7Ge2OrdU68PE8oxlxsIFnhTeMUzQ==","X-Received":["by 10.157.37.28 with SMTP id k28mr606924otb.18.1466493783684;\n\tTue, 21 Jun 2016 00:23:03 -0700 (PDT)","by 10.129.82.200 with SMTP id g191mr8517616ywb.28.1466493783464; \n\tTue, 21 Jun 2016 00:23:03 -0700 (PDT)","by 10.98.134.196 with SMTP id x187mr26730087pfd.21.1466493783153;\n\tTue, 21 Jun 2016 00:23:03 -0700 (PDT)"],"MIME-Version":"1.0","X-BeenThere":"rtc-linux@googlegroups.com","Received-SPF":"pass (google.com: domain of andrew.smirnov@gmail.com\n\tdesignates 2607:f8b0:400e:c00::242 as permitted sender)\n\tclient-ip=2607:f8b0:400e:c00::242; ","From":"Andrey Smirnov <andrew.smirnov@gmail.com>","To":"rtc-linux@googlegroups.com","Cc":"Andrey Smirnov <andrew.smirnov@gmail.com>,\n\tAlessandro Zummo <a.zummo@towertech.it>,\n\tAlexandre Belloni <alexandre.belloni@free-electrons.com>,\n\tlinux-kernel@vger.kernel.org, cphealy@gmail.com","Subject":"[rtc-linux] [PATCH v2 05/17] RTC: ds1307: Convert\n\tds1307_can_wakeup_device into a predicate","Date":"Tue, 21 Jun 2016 00:22:38 -0700","Message-Id":"<1466493770-11895-4-git-send-email-andrew.smirnov@gmail.com>","X-Mailer":"git-send-email 2.5.5","In-Reply-To":"<1466493770-11895-1-git-send-email-andrew.smirnov@gmail.com>","References":"<1466493770-11895-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\n\theader.i=@gmail.com;       spf=pass (google.com: domain of\n\tandrew.smirnov@gmail.com designates 2607:f8b0:400e:c00::242 as\n\tpermitted\n\tsender) smtp.mailfrom=andrew.smirnov@gmail.com; dmarc=pass (p=NONE\n\tdis=NONE) header.from=gmail.com","Reply-To":"rtc-linux@googlegroups.com","Content-Type":"text/plain; charset=UTF-8","Precedence":"list","Mailing-list":"list rtc-linux@googlegroups.com;\n\tcontact rtc-linux+owners@googlegroups.com","List-ID":"<rtc-linux.googlegroups.com>","X-Spam-Checked-In-Group":"rtc-linux@googlegroups.com","X-Google-Group-Id":"712029733259","List-Post":"<https://groups.google.com/group/rtc-linux/post>,\n\t<mailto:rtc-linux@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:rtc-linux+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/rtc-linux","List-Subscribe":"<https://groups.google.com/group/rtc-linux/subscribe>,\n\t<mailto:rtc-linux+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+712029733259+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/rtc-linux/subscribe>"},"content":"Convert ds1307_can_wakeup_device in ds1307_probe into a predicate in\norder to make various chunks of code in that function less connected to\neach other.\n\nSigned-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>\n---\n drivers/rtc/rtc-ds1307.c | 35 ++++++++++++++++++-----------------\n 1 file changed, 18 insertions(+), 17 deletions(-)","diff":"diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c\nindex b21ea5d..98e1f81 100644\n--- a/drivers/rtc/rtc-ds1307.c\n+++ b/drivers/rtc/rtc-ds1307.c\n@@ -1232,6 +1232,21 @@ static void ds1307_clks_register(struct ds1307 *ds1307)\n \n #endif /* CONFIG_COMMON_CLK */\n \n+static bool ds1307_can_wakeup_device(const struct ds1307 *ds1307)\n+{\n+\n+/*\n+ * For devices with no IRQ directly connected to the SoC, the RTC chip\n+ * can be forced as a wakeup source by stating that explicitly in\n+ * the device's .dts file using the \"wakeup-source\" boolean property.\n+ * If the \"wakeup-source\" property is set, don't request an IRQ.\n+ * This will guarantee the 'wakealarm' sysfs entry is available on the device,\n+ * if supported by the RTC.\n+ */\n+\treturn of_property_read_bool(ds1307->client->dev.of_node,\n+\t\t\t\t     \"wakeup-source\");\n+}\n+\n static int ds1307_probe(struct i2c_client *client,\n \t\t\tconst struct i2c_device_id *id)\n {\n@@ -1241,7 +1256,6 @@ static int ds1307_probe(struct i2c_client *client,\n \tstruct chip_desc\t*chip = &chips[id->driver_data];\n \tstruct i2c_adapter\t*adapter = to_i2c_adapter(client->dev.parent);\n \tbool\t\t\twant_irq = false;\n-\tbool\t\t\tds1307_can_wakeup_device = false;\n \tunsigned char\t\t*buf;\n \tstruct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);\n \tirq_handler_t\tirq_handler = ds1307_irq;\n@@ -1290,20 +1304,6 @@ static int ds1307_probe(struct i2c_client *client,\n \t\tds1307->write_block_data = ds1307_write_block_data;\n \t}\n \n-#ifdef CONFIG_OF\n-/*\n- * For devices with no IRQ directly connected to the SoC, the RTC chip\n- * can be forced as a wakeup source by stating that explicitly in\n- * the device's .dts file using the \"wakeup-source\" boolean property.\n- * If the \"wakeup-source\" property is set, don't request an IRQ.\n- * This will guarantee the 'wakealarm' sysfs entry is available on the device,\n- * if supported by the RTC.\n- */\n-\tif (of_property_read_bool(client->dev.of_node, \"wakeup-source\")) {\n-\t\tds1307_can_wakeup_device = true;\n-\t}\n-#endif\n-\n \tswitch (ds1307->type) {\n \tcase ds_1337:\n \tcase ds_1339:\n@@ -1357,7 +1357,7 @@ static int ds1307_probe(struct i2c_client *client,\n \t\tds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);\n \n \t\tif (chip->alarm && (ds1307->client->irq > 0 ||\n-\t\t\t\t    ds1307_can_wakeup_device))\n+\t\t\t\t    ds1307_can_wakeup_device(ds1307)))\n \t\t\twant_irq = true;\n \n \t\ti2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,\n@@ -1567,7 +1567,8 @@ read_rtc:\n \t\treturn PTR_ERR(ds1307->rtc);\n \t}\n \n-\tif (ds1307_can_wakeup_device && ds1307->client->irq <= 0) {\n+\tif (ds1307_can_wakeup_device(ds1307) &&\n+\t    ds1307->client->irq <= 0) {\n \t\t/* Disable request for an IRQ */\n \t\twant_irq = false;\n \t\tdev_info(&client->dev, \"'wakeup-source' is set, request for an IRQ is disabled!\\n\");\n","prefixes":["v2","05/17"]}