From patchwork Mon Jan 11 12:40:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 12010511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14A26C433DB for ; Mon, 11 Jan 2021 12:41:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF07E2250F for ; Mon, 11 Jan 2021 12:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727025AbhAKMl1 (ORCPT ); Mon, 11 Jan 2021 07:41:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbhAKMlS (ORCPT ); Mon, 11 Jan 2021 07:41:18 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15844C06179F for ; Mon, 11 Jan 2021 04:40:38 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id q18so16298372wrn.1 for ; Mon, 11 Jan 2021 04:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AmSSoDbc+2rw/4h75XEqx7jHACxZ7FHCs9p6Wbzi2zM=; b=0F+jeZbn/40ig5h5AsQvYwqSYf1roFYcuJpr1OS3UvzrbytMIJ7EiDuCQSDHRaIAMY n2CeXadk2IUrJS0x9s3gKYZbz0L1u80EfJBuy0dS6DFLDcc50cSYcNRNCMLrs8nImVU2 +YRGvIE8jCudGBWitBLK3UuQYHImzdxj9KMNXkwFIIhcjgtVk2OF92mRgFgG7YGOf68L GMq0C1WQtguxs5kDudfJ4yq2LJnTyZntoRSXkEWGGiGBmIYwofir4BWaW2IFuWw+YXkA yE5hfWrJQH+rpiDuejhQIdeydzg2deecZKAJ2lM7t5sfbNq1ZC0PuzfeoDi2o/XDDy1X MfJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AmSSoDbc+2rw/4h75XEqx7jHACxZ7FHCs9p6Wbzi2zM=; b=WCEFJ7rvClVQNRC0m1AV7YXzEQwMPewbcVO8D8QI3im2NbxAIowNS1Wm/seeS9C4vK 1neFBNZBa70u9lOEbFZ5iS/r0hTGDu2xS0WVe9wSc852lpdrmQo7InnNC1lRdcBvReW5 4tQam+AELc7pncLUQehI9cic6nHY9dIigl0IY8n3Bmx4fwezPNWOH2vV8d7USPEKx+JP fQXZclxu7xUhh8OaR84Po43gZzcpRWdhSXVMVrxxY7L3vlslq4nic2NS4Pya434oQup5 VKBhWudDpowElFzY6boXaLszsZ2Rs+DjQZPbvBJC02j979frd7tpfDOgY7n0WKBx4Fpt 408Q== X-Gm-Message-State: AOAM531Knk9u7Nc8dncrfKrv7gBaRttFSB8gwD8/hyCFA0FytMFCqjha wFLTho2MBKKQOqs/u4LF1ShRFA== X-Google-Smtp-Source: ABdhPJx/JvGKoQ6786uAag5YOB20houzOa4TJHJiLsy2xCYGN6LcTS6vCSnTEqTyzHm4gA8W7tQKuw== X-Received: by 2002:adf:ee10:: with SMTP id y16mr16344895wrn.296.1610368836875; Mon, 11 Jan 2021 04:40:36 -0800 (PST) Received: from debian-brgl.home (amarseille-656-1-4-167.w90-8.abo.wanadoo.fr. [90.8.158.167]) by smtp.gmail.com with ESMTPSA id l8sm26492362wrb.73.2021.01.11.04.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 04:40:36 -0800 (PST) From: Bartosz Golaszewski To: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alessandro Zummo , Alexandre Belloni Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-rtc@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C Date: Mon, 11 Jan 2021 13:40:25 +0100 Message-Id: <20210111124027.21586-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20210111124027.21586-1-brgl@bgdev.pl> References: <20210111124027.21586-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Bartosz Golaszewski The rtc-s5m uses the I2C regmap but doesn't select it in Kconfig so depending on the configuration the build may fail. Fix it. Signed-off-by: Bartosz Golaszewski Reviewed-by: Krzysztof Kozlowski --- drivers/rtc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 6123f9f4fbc9..e4bef40831c7 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -692,6 +692,7 @@ config RTC_DRV_S5M tristate "Samsung S2M/S5M series" depends on MFD_SEC_CORE || COMPILE_TEST select REGMAP_IRQ + select REGMAP_I2C help If you say yes here you will get support for the RTC of Samsung S2MPS14 and S5M PMIC series. From patchwork Mon Jan 11 12:40:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 12010513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3A8CC433E6 for ; Mon, 11 Jan 2021 12:41:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A2DB224B8 for ; Mon, 11 Jan 2021 12:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727075AbhAKMl6 (ORCPT ); Mon, 11 Jan 2021 07:41:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbhAKMl6 (ORCPT ); Mon, 11 Jan 2021 07:41:58 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A0FC0617A5 for ; Mon, 11 Jan 2021 04:40:38 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id 91so16271683wrj.7 for ; Mon, 11 Jan 2021 04:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v3qbp3ZMuwuzWhmCass4IRAk8ZAQ/ACJDj2q433vAbg=; b=P+TwWLiTjF1qmaarNqsVKWNM+dj4npSIcBOUzlo8IeXig9P8wZj61dOgCRFAjWO8dI el0XHCO9VI68C3rOzzKgrBlH2CqCgMbd52JSicFo/WvKlqHm+SNqmO9Lm7efZqFPkKRK TT+EmyCCHP4O95eF+qg/MNDR6lWwZCW3seProocfEtg5DQ7kPEALk9G8qHYILXkyu3UW rW041WasCI9qrc8nELQFX5CAZVP1w3LoT95tvPFMuAC4vHBvLWWhDeDdwVGTI46K4r3T Ngd9xSOIvSRo4JPqY/OS7UaQsAiHeHpzSBlUWMuWOC/DxyUxyGyLUlI6uT1E1Uhh4lnp fVwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v3qbp3ZMuwuzWhmCass4IRAk8ZAQ/ACJDj2q433vAbg=; b=QsvSiH7vRdf57XMftsAM/axFO4e/WTg7Bypi1ixapdWtAhhp9d6j5ZCmHExLQ/tMMO imqWjdN58O2s0Mxv7ZLku7FtyeM5tmO9K7FfHCc36CAf7Twy/cdHuHzOzdxew+hSsWEZ 1m3tVfnKS/qmAGz2Pyr9VscpAb9bNhn7+DK8F8dcr/6Q/wNi4FuX2rR2c7bTy5V/lfF/ 0lPVDp1Z+TenYqpidqemAWJyOlbkEu+9lozdgvoXFcaUGh4ohl5H0H467ZM3hiFyUKOS YB409Gv/JJgI0w6NzSHA1/721sVWDRQcntF1yPGZ8TCr8eJUHnJTQg+sZBrTjFMDtjNZ sw8Q== X-Gm-Message-State: AOAM531saJMvqOSHBVZKgpm2jKExaPNFoWaXMg6oaHmdiY5Mwh+eNika vIp4WiYd2R8ufdBP8ipfAFGDgA== X-Google-Smtp-Source: ABdhPJx98mZybXSuv26a4jd1+q/Aole2pms6hjLnF+Q1HUOM04J0+ZjH3h0TYXXuX0JtSP1HEmYJ8w== X-Received: by 2002:a5d:6751:: with SMTP id l17mr16060283wrw.73.1610368837747; Mon, 11 Jan 2021 04:40:37 -0800 (PST) Received: from debian-brgl.home (amarseille-656-1-4-167.w90-8.abo.wanadoo.fr. [90.8.158.167]) by smtp.gmail.com with ESMTPSA id l8sm26492362wrb.73.2021.01.11.04.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 04:40:37 -0800 (PST) From: Bartosz Golaszewski To: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alessandro Zummo , Alexandre Belloni Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-rtc@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Date: Mon, 11 Jan 2021 13:40:26 +0100 Message-Id: <20210111124027.21586-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20210111124027.21586-1-brgl@bgdev.pl> References: <20210111124027.21586-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Bartosz Golaszewski This function can fail if regmap operations fail so check its return value in probe(). Signed-off-by: Bartosz Golaszewski --- drivers/rtc/rtc-s5m.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index eb9dde4095a9..e0011d3cf61b 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -791,6 +791,8 @@ static int s5m_rtc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, info); ret = s5m8767_rtc_init_reg(info); + if (ret) + return ret; device_init_wakeup(&pdev->dev, 1); From patchwork Mon Jan 11 12:40:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 12010515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92118C433DB for ; Mon, 11 Jan 2021 12:42:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64BF62251F for ; Mon, 11 Jan 2021 12:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726876AbhAKMl7 (ORCPT ); Mon, 11 Jan 2021 07:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbhAKMl6 (ORCPT ); Mon, 11 Jan 2021 07:41:58 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A06C0617A9 for ; Mon, 11 Jan 2021 04:40:39 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id g185so14932917wmf.3 for ; Mon, 11 Jan 2021 04:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iLQSMu4kyOWwZDRuRCxs8aoK2DhXG2sbIHqKebgLZs8=; b=YtHZifkBaY0OPg54db/1GEuBl6VpUDZZNAf4YQVSyEgPjRg25raahc/YvwMJ0nvVnx 6V/vWalce3AnXvu7lqT5zQ8X+tW8TmHheC1EpP/njLVKre8dGO2rzPdBuva5n3CYaU9v m3xKBt7F68+9mV4hDNyqj10kkiZUPJLMVv3ImgU73RtgzfYCf4LUwYL2ChS2HOy/1UX0 6qJ3KhL0F0DpStRKvMXxFdW5BtfqZ4lCW1nOxcsQpeiKV0DCPZpfNWJgaoWkU4w5IqGn zIIBf/HHj/7r6aZLpYOAMV1dsuFnM2b7g5Uz8d4mXxQ0b2lAYDywqQ7MScdjzsvfPGff pMfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iLQSMu4kyOWwZDRuRCxs8aoK2DhXG2sbIHqKebgLZs8=; b=LznkBSfLQpfa6MxuK0HyU6hfBj5DSHDPloBta0h0cbTKNyhuMeIA1Yi1HdfvgBLAvH GtgFLSRscmDzI4acKvWYAr5Aw5LC0LLboLRblEO7SjAioDdgC447tqGLqmAw48fShTtb 2hwWcsz7sH4gXv1azcE7qEDZV6Hr/IPwW2oRVUmM3nsyVWdeJgXUZwZi8veL+9gySUOh VflSIB4BfAIxNLWiy+auv4YLIVLlZu3hVbfu2AfvW27J4/+6O+mfan1RuPAldvV8Vbo0 xpCP0MPNuUqMmzAGmfuwYbs32p1phJjQOpjoukgWJDeuWddUQS4cgou3xcw+11TcrLLY +HlQ== X-Gm-Message-State: AOAM5328DaGKnqgGrPMM6u13cDi8wfZAqiABj4dvlqOZCJaP69sFO8AZ 0LMC1NsZS+7mQMdtVXCGqsLjzw== X-Google-Smtp-Source: ABdhPJy7IwW7rqicRJkE+1lyoV7lllzeWL26215H1ry1DCRVDrmCZu4Y2vJ0uDYfSxjfCx2mNGo6Lw== X-Received: by 2002:a1c:6208:: with SMTP id w8mr14496011wmb.96.1610368838524; Mon, 11 Jan 2021 04:40:38 -0800 (PST) Received: from debian-brgl.home (amarseille-656-1-4-167.w90-8.abo.wanadoo.fr. [90.8.158.167]) by smtp.gmail.com with ESMTPSA id l8sm26492362wrb.73.2021.01.11.04.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 04:40:38 -0800 (PST) From: Bartosz Golaszewski To: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alessandro Zummo , Alexandre Belloni Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-rtc@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() Date: Mon, 11 Jan 2021 13:40:27 +0100 Message-Id: <20210111124027.21586-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20210111124027.21586-1-brgl@bgdev.pl> References: <20210111124027.21586-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Bartosz Golaszewski Use the managed variant of i2c_new_dummy_device() to shrink code and remove the goto label. We can drop the remove callback now too. Signed-off-by: Bartosz Golaszewski Reviewed-by: Krzysztof Kozlowski --- drivers/rtc/rtc-s5m.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index e0011d3cf61b..80b66f16db89 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -760,7 +760,8 @@ static int s5m_rtc_probe(struct platform_device *pdev) return -ENODEV; } - info->i2c = i2c_new_dummy_device(s5m87xx->i2c->adapter, RTC_I2C_ADDR); + info->i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter, + RTC_I2C_ADDR); if (IS_ERR(info->i2c)) { dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n"); return PTR_ERR(info->i2c); @@ -771,7 +772,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) ret = PTR_ERR(info->regmap); dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n", ret); - goto err; + return ret; } info->dev = &pdev->dev; @@ -781,10 +782,9 @@ static int s5m_rtc_probe(struct platform_device *pdev) if (s5m87xx->irq_data) { info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); if (info->irq <= 0) { - ret = -EINVAL; dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", alarm_irq); - goto err; + return -EINVAL; } } @@ -799,10 +799,8 @@ static int s5m_rtc_probe(struct platform_device *pdev) info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc", &s5m_rtc_ops, THIS_MODULE); - if (IS_ERR(info->rtc_dev)) { - ret = PTR_ERR(info->rtc_dev); - goto err; - } + if (IS_ERR(info->rtc_dev)) + return PTR_ERR(info->rtc_dev); if (!info->irq) { dev_info(&pdev->dev, "Alarm IRQ not available\n"); @@ -815,23 +813,9 @@ static int s5m_rtc_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", info->irq, ret); - goto err; + return ret; } - return 0; - -err: - i2c_unregister_device(info->i2c); - - return ret; -} - -static int s5m_rtc_remove(struct platform_device *pdev) -{ - struct s5m_rtc_info *info = platform_get_drvdata(pdev); - - i2c_unregister_device(info->i2c); - return 0; } @@ -876,7 +860,6 @@ static struct platform_driver s5m_rtc_driver = { .pm = &s5m_rtc_pm_ops, }, .probe = s5m_rtc_probe, - .remove = s5m_rtc_remove, .id_table = s5m_rtc_id, };