Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4224304ybl; Tue, 20 Aug 2019 08:43:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeSSR8vu0Vq3PhdVNqSrlW4IyRAZSBq1kKQQw7GBM2s+8kkCqVXdu4UU9pHyglaePZJsAH X-Received: by 2002:a17:902:7049:: with SMTP id h9mr29529503plt.232.1566315836470; Tue, 20 Aug 2019 08:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566315836; cv=none; d=google.com; s=arc-20160816; b=Cu5NzAMEO4WkzkCLl26xObmNLbXOgkTJcPgqRw+ddi3QIpgODInK8q+jjL762i+d7S tPSR7c4I+jAXdvPVFX0KJGxgVgVn8huJlTOpZGzg4PFHQuX7dZPHKqTyu+KpwQp1RAnA 5E/TIE7sy0LWwbnQy3l910a6iNtYRpm8Vm/efwaZfO+KZKEppAMeV1kTywJ9OipsECer PQjEDMKnJA/cSlmXNVvHn5jDzxNcH+64sZ60CYI5i4+1+kL0z6gHXclkarkhoGU2OUj8 nHeIveGifWICPRpR2zeAiJ73Dv5GvRRzXtCbMsnaqu/XC9bRgnyISuDr+3C0Bb9eNd8O rWDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=t/c0LBlyAwwlEOcdKeDKxTh/TPR8fRVGneHdSPcGxv0=; b=pKNZYoleElKOrpIxwbhhvCBhWa9m+X7Z4polPPAE2Qwwt3g1h9bfbesw0Z9BDO2Aca oIPhWmCM0JOX49RIRZB2+2oaL3jCYOQm5kGD1eFz6awxUXJjqJBNRCLAFE6BQWAo0sOu 0qo4/SLVjKDzbHu/4ezi03pnSe1IpwVASudJJWL5KFipDkx/US8OUv8UEjyFijr+8R0W OZLnxOXj8MjPEZeNtdwbNOSIIr4Oh+tzvb4PLrzO4010nzPXIHs+3HMqK0sQk/wo4bg+ btw18+MJSQNBwzSjimnVVUaiwUSw1w24rkmZcJg7IzXiA2ZKJU1+YYOUwbSjG1Qr+GyW fVdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20si12592080pgc.503.2019.08.20.08.43.41; Tue, 20 Aug 2019 08:43:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729981AbfHTPmt (ORCPT + 99 others); Tue, 20 Aug 2019 11:42:49 -0400 Received: from sauhun.de ([88.99.104.3]:37538 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbfHTPmr (ORCPT ); Tue, 20 Aug 2019 11:42:47 -0400 Received: from localhost (p54B333DC.dip0.t-ipconnect.de [84.179.51.220]) by pokefinder.org (Postfix) with ESMTPSA id 9BA0D2E40A2; Tue, 20 Aug 2019 17:42:45 +0200 (CEST) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Alessandro Zummo , Alexandre Belloni , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device() Date: Tue, 20 Aug 2019 17:42:37 +0200 Message-Id: <20190820154239.8230-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190820154239.8230-1-wsa+renesas@sang-engineering.com> References: <20190820154239.8230-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I was about to simplify the call to i2c_unregister_device() when I realized that converting to devm_i2c_new_dummy_device() will simplify the driver a lot. So I took this approach. Signed-off-by: Wolfram Sang --- Build tested only, buildbot is happy, too. Please apply to your tree. drivers/rtc/rtc-max77686.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index d04fd1024697..4027b33034dc 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -693,8 +693,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; } - info->rtc = i2c_new_dummy_device(parent_i2c->adapter, - info->drv_data->rtc_i2c_addr); + info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter, + info->drv_data->rtc_i2c_addr); if (IS_ERR(info->rtc)) { dev_err(info->dev, "Failed to allocate I2C device for RTC\n"); return PTR_ERR(info->rtc); @@ -705,7 +705,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) if (IS_ERR(info->rtc_regmap)) { ret = PTR_ERR(info->rtc_regmap); dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret); - goto err_unregister_i2c; + return ret; } add_rtc_irq: @@ -715,15 +715,10 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) &info->rtc_irq_data); if (ret < 0) { dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret); - goto err_unregister_i2c; + return ret; } return 0; - -err_unregister_i2c: - if (info->rtc) - i2c_unregister_device(info->rtc); - return ret; } static int max77686_rtc_probe(struct platform_device *pdev) @@ -786,8 +781,6 @@ static int max77686_rtc_probe(struct platform_device *pdev) err_rtc: regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data); - if (info->rtc) - i2c_unregister_device(info->rtc); return ret; } @@ -798,8 +791,6 @@ static int max77686_rtc_remove(struct platform_device *pdev) free_irq(info->virq, info); regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data); - if (info->rtc) - i2c_unregister_device(info->rtc); return 0; } -- 2.20.1