Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp154930pxb; Thu, 14 Jan 2021 02:26:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCvE4oCJAHJUOMxuw9XAXjxm6+PyHsc/DeNSSzzlFcvYXKUIMlzhpvGmIXGrGDBamzidmS X-Received: by 2002:a05:6402:46:: with SMTP id f6mr5240755edu.163.1610619965015; Thu, 14 Jan 2021 02:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610619965; cv=none; d=google.com; s=arc-20160816; b=iGA/ihxj3Vo7PKJBA4dHoOSu7ymLFqF6SIAorTyyHfYByRsIlZiVwl24Z387LUAE3Y g6eM0+MBAbdy+alkyhy1qYjovR60O5sDlt1JReKsyVfCaWrtE+ny/9YDkYg1dQrJD7cq EB1CjQAxDiE8iWa9GcYfgx5v8Lr3qa2GVQRrw2pgToa6ooRyWnTgG5u8qdDk3Hm0H8yX qRCjab9Yz9Lo4DL/GKE6WwWLzktVxvup2zBqthwDl9ZkaRR8jsfXKcac+qD5S9rWtBv2 5P4WPCfILa2FjVNHoKGCHjbKw6gjyXKP/5Hqp4x+Kebdj2neIbOg7dX6hUaHLhL3qDC6 iAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kGv8QrRdv3vCCcpWkYEIkCuQbV4ftPlge50FODH3uVg=; b=DGnYsPnJXRXMVyCZ0fC6AbbHhI6glr7iA5nQEmBd+YM2xsJ7qQ4jCbZoTSjirtMnm9 Dtdf6uIovyjxtyESFl+TnQRp8t7o5kkHZGOGw+JDpgacBBijPbKHNS6LZZEOgJBsGiIt i3/PDMMnU377UWLW+7T9rV4ZZEN7ISCgC3gAI7sYuVpVDWa9IH7V0wWpsLHeXe+pVSbn 1U76zbDpfsZiRyslcOSYhifqsQ83WXqAkV/h1aYjeeoT+f5LNvqvInowO1k3fqoCNt7i xn9s344sB/NSxbReC6RAR8U9IXeqTu9ck/QKqwdEVlyFm9t8OB/TVdOH8UdE1uA38h46 Yc4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=uDyryazW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si2173241ejv.446.2021.01.14.02.25.40; Thu, 14 Jan 2021 02:26:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=uDyryazW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbhANKXv (ORCPT + 99 others); Thu, 14 Jan 2021 05:23:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727349AbhANKXu (ORCPT ); Thu, 14 Jan 2021 05:23:50 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F4A7C0613D6 for ; Thu, 14 Jan 2021 02:22:26 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id a6so4053054wmc.2 for ; Thu, 14 Jan 2021 02:22:26 -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=kGv8QrRdv3vCCcpWkYEIkCuQbV4ftPlge50FODH3uVg=; b=uDyryazWNCsTwd2/U5Q6H067pMAoezbQHdb2LTFxZR+KDir/2zSvAxyhdNWyMnzRkB 0vd92xVYqgCAbmnnTC//9acLIP7H1ePYzpCRcTXR47+j9ZimTtvsDPJ2iT0v/jZ2/U/C pDL+cYPMolJzFF5s1cN/fp5EdrMOPm4MQoGXhFPtdN3DvZDllRV3HdQHACjjCFEyhxM2 fh2sGIouiky9yHexEa1qb0XL+SbfN5Ep7gKlUnqNzxvZ22nXkGN0XNX1XdT65/L2k2Yx 7Qg7Hj8JPWpyR5U6Mj5p+qdvcn3pV+pITbnf05J/f7eXWCyjzE8f/KdgtSPALJfUl+Do F6wQ== 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=kGv8QrRdv3vCCcpWkYEIkCuQbV4ftPlge50FODH3uVg=; b=VLobbcSCC0AapNLxCDRPItl0cfAMrMT4aTcAiaLO0DbMXqo/dyJ//qcn6Co8OK7IVE K00GPPE+Q5+yDCKDDlukeSkQvSP27uiy3//H+Lo3qFH5T5MWLMe04cotTMarwMby9DO3 Mr0x7oDthMBLwqI/w3uAnP02DBvAmhiYoiTGBMfsGgSnVS1uBvXNK+ASeOBtJl2vQlzV DpWvz431kgz5tpf37/Z9woOjvE3DO8Pw8+y8nmxYFLbkUxKuRSNtm4FIJbYBZqIgIR+7 rstUJJtr3NxTwbB1fGe9N/5haQXtr+p5Coy/XEX0ZY89hnBGIeAlEggVxnvM11dm51Ds bQ5w== X-Gm-Message-State: AOAM531rykRTzzwGrypCBAA6O7w9L+IX1q9+ecG3Zm1eyT52y4+5gRn0 vd5hWqyNx7wTDCJ5JIvfwTxiCQ== X-Received: by 2002:a1c:dc46:: with SMTP id t67mr2019917wmg.183.1610619745017; Thu, 14 Jan 2021 02:22:25 -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 l7sm2468467wmg.41.2021.01.14.02.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 02:22:24 -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 v5 2/3] rtc: s5m: use devm_i2c_new_dummy_device() Date: Thu, 14 Jan 2021 11:22:18 +0100 Message-Id: <20210114102219.23682-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20210114102219.23682-1-brgl@bgdev.pl> References: <20210114102219.23682-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 eb9dde4095a9..858d5f0e860f 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; } } @@ -797,10 +797,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"); @@ -813,23 +811,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; } @@ -874,7 +858,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, }; -- 2.29.1