From patchwork Sun Apr 14 14:20:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 236445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ia0-x23a.google.com (mail-ia0-x23a.google.com [IPv6:2607:f8b0:4001:c02::23a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A6F962C00D4 for ; Mon, 15 Apr 2013 00:20:29 +1000 (EST) Received: by mail-ia0-f186.google.com with SMTP id k25sf1313474iah.3 for ; Sun, 14 Apr 2013 07:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-received:x-beenthere:x-received:received-spf:x-received :message-id:subject:from:to:cc:date:in-reply-to:references:x-mailer :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-google-group-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=MhkMY7xcpIuYH5LhyadEc+ylsKNkAxR0Vai4myqk/3I=; b=UWKWzYFgw1AQF05nVVa0yH/K6kvsbW+r3AhuSY1Y0K5I9sTQuzLUSTzqG7J4VCIHK1 bOFihxPrmdiN1ZWc6L+KCFU3FDcZ+nntmGLaWl+V2l95EvXEVuhJaoB3T3OGkNgUkxXq 5qWq7XvsFDVs1RlAKzhr2ROYoHI4nLL6/8m9tyEkWdYXVENwZsC9NxF+SR/tBWcS/ayK 4cyfMh43UYTOZYmqVAZexWxiVSWMGLvKpmecfdkSAXg0BH7hUQ27ADCj+rar/dz4ob5u LdjV2KS8OHH05SyZmee9s+/DNLHh+HbmeMSHZofC9+3rv6StfOjzP4ykTZy1sbR7IKEM gfjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :message-id:subject:from:to:cc:date:in-reply-to:references:x-mailer :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=MhkMY7xcpIuYH5LhyadEc+ylsKNkAxR0Vai4myqk/3I=; b=n3vY0N8HefzsYoDRejTEekHwd7y3X8tlAdV1tsU9FLnIAaOha/f+EblaCk3CRBYD5R LYNnjyeKzIGjut6Ma/46aeDBV+kuT2eKicxKSz375XnnFd9zCL1cKsQMduRV9JjcbQ+4 /MyTy+N8QmVfN8emFHCYEG0ChizbST5aRMxOv4Ve7CdRW/XaWvUkDj6dAp//M4xL8w21 aawKFWfqH5N/CuRqDXJ6kL2ZZEMvgtVGZokOAThCSF1TXr/0k1FGliKWWV4BW0H18jLl bc+3LNYKmNH7I16f0CXR8KAbKgKth0Tps+mEQ/eECCWu2I0ERagZvmq7WFwH5iObD9kX fmfw== X-Received: by 10.50.170.68 with SMTP id ak4mr560590igc.1.1365949227074; Sun, 14 Apr 2013 07:20:27 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.159.133 with SMTP id xc5ls784521igb.3.canary; Sun, 14 Apr 2013 07:20:26 -0700 (PDT) X-Received: by 10.66.26.195 with SMTP id n3mr2422542pag.43.1365949226549; Sun, 14 Apr 2013 07:20:26 -0700 (PDT) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by gmr-mx.google.com with ESMTPS id tx7si2937746pbc.0.2013.04.14.07.20.26 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 14 Apr 2013 07:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of axel.lin@ingics.com designates 209.85.192.172 as permitted sender) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id 5so2095050pdd.17 for ; Sun, 14 Apr 2013 07:20:26 -0700 (PDT) X-Received: by 10.68.198.69 with SMTP id ja5mr24582026pbc.183.1365949226471; Sun, 14 Apr 2013 07:20:26 -0700 (PDT) Received: from [192.168.0.102] (111-255-125-41.dynamic.hinet.net. [111.255.125.41]) by mx.google.com with ESMTPS id yp2sm17974990pab.10.2013.04.14.07.20.23 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 14 Apr 2013 07:20:25 -0700 (PDT) Message-ID: <1365949220.16287.2.camel@phoenix> Subject: [rtc-linux] [PATCH 3/3] rtc: pcf8583: Convert to use devm_* API From: Axel Lin To: Andrew Morton Cc: "G. Liakhovetski" , Jingoo Han , Alessandro Zummo , rtc-linux@googlegroups.com Date: Sun, 14 Apr 2013 22:20:20 +0800 In-Reply-To: <1365949109.16287.0.camel@phoenix> References: <1365949109.16287.0.camel@phoenix> X-Mailer: Evolution 3.6.2-0ubuntu0.1 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQlmZUOxhS9xxHTo1BTzTeUBUSwtkFuDHzAZpGQ/DcEF1qvXYFBAevUBjnIr5dqyH1g5W+03 X-Original-Sender: axel.lin@ingics.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of axel.lin@ingics.com designates 209.85.192.172 as permitted sender) smtp.mail=axel.lin@ingics.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-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Signed-off-by: Axel Lin --- drivers/rtc/rtc-pcf8583.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index 5f97c61..cd4bddb 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c @@ -39,7 +39,6 @@ struct pcf8583 { #define CTRL_ALARM 0x02 #define CTRL_TIMER 0x01 - static struct i2c_driver pcf8583_driver; #define get_ctrl(x) ((struct pcf8583 *)i2c_get_clientdata(x))->ctrl @@ -268,39 +267,28 @@ static int pcf8583_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pcf8583 *pcf8583; - int err; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; - pcf8583 = kzalloc(sizeof(struct pcf8583), GFP_KERNEL); + pcf8583 = devm_kzalloc(&client->dev, sizeof(struct pcf8583), + GFP_KERNEL); if (!pcf8583) return -ENOMEM; i2c_set_clientdata(client, pcf8583); - pcf8583->rtc = rtc_device_register(pcf8583_driver.driver.name, - &client->dev, &pcf8583_rtc_ops, THIS_MODULE); - - if (IS_ERR(pcf8583->rtc)) { - err = PTR_ERR(pcf8583->rtc); - goto exit_kfree; - } + pcf8583->rtc = devm_rtc_device_register(&client->dev, + pcf8583_driver.driver.name, + &pcf8583_rtc_ops, THIS_MODULE); + if (IS_ERR(pcf8583->rtc)) + return PTR_ERR(pcf8583->rtc); return 0; - -exit_kfree: - kfree(pcf8583); - return err; } static int pcf8583_remove(struct i2c_client *client) { - struct pcf8583 *pcf8583 = i2c_get_clientdata(client); - - if (pcf8583->rtc) - rtc_device_unregister(pcf8583->rtc); - kfree(pcf8583); return 0; }