From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 352C6ECE58C for ; Mon, 7 Oct 2019 13:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1532B20673 for ; Mon, 7 Oct 2019 13:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728310AbfJGNxx (ORCPT ); Mon, 7 Oct 2019 09:53:53 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:44401 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfJGNxx (ORCPT ); Mon, 7 Oct 2019 09:53:53 -0400 X-Originating-IP: 86.207.98.53 Received: from localhost (aclermont-ferrand-651-1-259-53.w86-207.abo.wanadoo.fr [86.207.98.53]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B061AC0003; Mon, 7 Oct 2019 13:53:49 +0000 (UTC) Date: Mon, 7 Oct 2019 15:53:49 +0200 From: Alexandre Belloni To: Stephen Boyd Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Geert Uytterhoeven , Jason Cooper , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Alessandro Zummo , Rob Herring , Frank Rowand , linux-rtc@vger.kernel.org Subject: Re: [PATCH 03/10] rtc: armada38x: Use of_device_get_match_data() Message-ID: <20191007135349.GN4254@piout.net> References: <20191004214334.149976-1-swboyd@chromium.org> <20191004214334.149976-4-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191004214334.149976-4-swboyd@chromium.org> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/10/2019 14:43:27-0700, Stephen Boyd wrote: > Use the more modern API to get the match data out of the of match table. > This saves some code, lines, and nicely avoids referencing the match > table when it is undefined with configurations where CONFIG_OF=n. > > Cc: Arnd Bergmann > Cc: Geert Uytterhoeven > Cc: Jason Cooper > Cc: Andrew Lunn > Cc: Gregory Clement > Cc: Sebastian Hesselbarth > Cc: Alessandro Zummo > Cc: Alexandre Belloni > Cc: Rob Herring > Cc: Frank Rowand > Cc: > Signed-off-by: Stephen Boyd Acked-by: Alexandre Belloni > --- > > Please ack or pick for immediate merge so the last patch can be merged. > > drivers/rtc/rtc-armada38x.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c > index 9351bd52477e..94d7c22fc4f3 100644 > --- a/drivers/rtc/rtc-armada38x.c > +++ b/drivers/rtc/rtc-armada38x.c > @@ -74,7 +74,7 @@ struct armada38x_rtc { > int irq; > bool initialized; > struct value_to_freq *val_to_freq; > - struct armada38x_rtc_data *data; > + const struct armada38x_rtc_data *data; > }; > > #define ALARM1 0 > @@ -501,17 +501,14 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) > { > struct resource *res; > struct armada38x_rtc *rtc; > - const struct of_device_id *match; > - > - match = of_match_device(armada38x_rtc_of_match_table, &pdev->dev); > - if (!match) > - return -ENODEV; > > rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc), > GFP_KERNEL); > if (!rtc) > return -ENOMEM; > > + rtc->data = of_device_get_match_data(&pdev->dev); > + > rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR, > sizeof(struct value_to_freq), GFP_KERNEL); > if (!rtc->val_to_freq) > @@ -553,7 +550,6 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) > */ > rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq; > } > - rtc->data = (struct armada38x_rtc_data *)match->data; > > /* Update RTC-MBUS bridge timing parameters */ > rtc->data->update_mbus_timing(rtc); > -- > Sent by a computer through tubes > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com