Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp993408pxb; Fri, 13 Aug 2021 10:49:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd0NB7GsBBHIFJ9qIZFX7+oURj3dK/+eZxKOrRZ5Fa5KSe8JOKeyHMXaVR49wwv74Kx9XC X-Received: by 2002:a05:6402:5192:: with SMTP id q18mr4506554edd.149.1628876962787; Fri, 13 Aug 2021 10:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628876962; cv=none; d=google.com; s=arc-20160816; b=o8ionJOEty8S0FxGmNMcjrVczBDIUvF9yviaHnVsO4fUL5Gi7YQKVomtrOMPtvr39C Urub8VdfMJRu/QxnHBpD1GzwCQHUcJUKq4XLXLOyqviC1MRwCObGphaNfm5nb0kChL0+ RwSHSFRmsWXU1ANG3nHo6amKFA6z2NP+safQD038KHIIaCRvL1IzNupkkQ3dSn8CNVcQ UmXyxwvwf/0MDKW9lrD6+q0O9tFUVOxwMCEsg/quEEJDJqaQwxap3e796Pv7hAAOWQZX GG20FPWDhiCPK47XwHnGX5cuE+pudVLHctUtgOlqJEOSwll0uo+yDQ0zE37sRRQUo6ZL 6d+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=IrzNo1b/3dS2SIE27GgVGBVi7cKXwHutKwdyiCoWpXA=; b=DgBXQ70x3RHGVFq/1TnBAkigwypcgC9pWf8HV/AFqWQQGI18VA8QY7xHtK+JRmrOqa eDo6iYDcxm4EQVOscJim8+K5VrlEm8uGqCh3pnKJYp+nLh7VP6XMF2T3tOozJSkvgm2T 8zL9U67Gh5T4GUM7Woxr/3Ph6ksN/VQ/RKT/hMma/f3/MAlSGKLXoY+ZmZygf2iSYVFx 9GXupbZpT5TXWPx4PAGtjYfUU0ummxyjJQ3VhTTyc3fNjHWNuMunNq+/4UidLMyjlrZC 4lTPsWteauyuJVdeGWH3vMxUCo6dG2F7rUFp2Jb64wMJ8TTK7LfvfXdtBUbwNW3fmUfT zY3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WDie7uGV; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si2204072ejb.219.2021.08.13.10.48.59; Fri, 13 Aug 2021 10:49:22 -0700 (PDT) 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=@google.com header.s=20161025 header.b=WDie7uGV; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbhHMRpu (ORCPT + 99 others); Fri, 13 Aug 2021 13:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbhHMRpq (ORCPT ); Fri, 13 Aug 2021 13:45:46 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E763C061756 for ; Fri, 13 Aug 2021 10:45:19 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id k65so20182047yba.13 for ; Fri, 13 Aug 2021 10:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=IrzNo1b/3dS2SIE27GgVGBVi7cKXwHutKwdyiCoWpXA=; b=WDie7uGVkKQkyl8uiEr0P4SvTm/CXRsjrhfKVivyYYwZeJmiACa2GSy56TEITv8W/i xijAdd/QwaJp45dWjO1tTu84nD+5X3oJXunUthSE6NZ297GroeYGN2ZahPKgXHJ46eqb 5pEhaGL+oNrG+Jle/gcBWa9K7fdUsttukJ0ShqhzlHJmDOtNkeYI0bE1IrrkLW8FiYQR MFKDJ3RgY0AjxMQappd3cRVzr0hxHfAm+EBlAkU9S1t/lujQW1BwBnqpbt4I+uMI86Il 4ep4X/7/M90flSjQrY0b5LvLLhbYqjelN1nRSVrk7xuIdZyjmAuiX9jTY2F73tb2tvLA if6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=IrzNo1b/3dS2SIE27GgVGBVi7cKXwHutKwdyiCoWpXA=; b=ATs9DyP87VaNLfUn45Hl6/4dnFdrFSKIWdFOWqAjCrtw+0EwYSc4NCMuDNRa/RIF+4 xNv1wlPrWbPQJ79DNgxtjTA0bYalBSfTnHI825b0R0mCr04mHA9WdE/GtMGz6NYAlQxY tX6XBYJKoiAiVrtzOchBxJx4vgCgHSbBworYRYnDS3GA/QILQhf5seAMrFwqPVfDoJ5K gXoRegmDlaZj7bmHZ9vKENuaOOcVEmRAlq2WLk4E98a/vL7ycyVoGMrWaEaqiMBFQ3E6 GP4E/DG5NhTnMHtdySyChaEIup7IP9DpZTHg84dAnhqSeo/y54go7WCz+uomC3IClnt0 Q3yQ== X-Gm-Message-State: AOAM5312wt82kB3nnIlED6QBSKM4taA6VDmhVWUucSBeEWobIP+qYuY/ oU9LgVCGaOgE6eBOhwQ7/4QgeyZY3+qscplrBzSp4A== X-Received: by 2002:a25:804:: with SMTP id 4mr4335433ybi.346.1628876718633; Fri, 13 Aug 2021 10:45:18 -0700 (PDT) MIME-Version: 1.0 References: <20210715065455.392923-1-zhang.lyra@gmail.com> <20210715065455.392923-4-zhang.lyra@gmail.com> <47dcce5a-f438-9f12-5b60-651dc5f2b92c@linaro.org> In-Reply-To: <47dcce5a-f438-9f12-5b60-651dc5f2b92c@linaro.org> From: Saravana Kannan Date: Fri, 13 Aug 2021 10:44:42 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] clocksource/drivers/sprd: Add module support to Unisoc timer To: Daniel Lezcano Cc: Chunyan Zhang , Thomas Gleixner , Baolin Wang , Orson Zhai , Chunyan Zhang , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 13, 2021 at 9:00 AM Daniel Lezcano wrote: > > On 15/07/2021 08:54, Chunyan Zhang wrote: > > From: Chunyan Zhang > > > > Timers still have devices created for them. So, when compiling a timer > > driver as a module, implement it as a normal platform device driver. > > > > Original-by: Baolin Wang > > Signed-off-by: Chunyan Zhang > > --- > > drivers/clocksource/Kconfig | 2 +- > > drivers/clocksource/timer-sprd.c | 15 ++++++++++----- > > 2 files changed, 11 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig > > index eb661b539a3e..a5a5b7c883ec 100644 > > --- a/drivers/clocksource/Kconfig > > +++ b/drivers/clocksource/Kconfig > > @@ -461,7 +461,7 @@ config MTK_TIMER > > Support for Mediatek timer driver. > > > > config SPRD_TIMER > > - bool "Spreadtrum timer driver" if EXPERT > > + tristate "Spreadtrum timer driver" if EXPERT > > depends on HAS_IOMEM > > depends on (ARCH_SPRD || COMPILE_TEST) > > default ARCH_SPRD > > diff --git a/drivers/clocksource/timer-sprd.c b/drivers/clocksource/tim= er-sprd.c > > index 430cb99d8d79..a8a7d3ea3464 100644 > > --- a/drivers/clocksource/timer-sprd.c > > +++ b/drivers/clocksource/timer-sprd.c > > @@ -5,6 +5,8 @@ > > > > #include > > #include > > +#include > > +#include > > > > #include "timer-of.h" > > > > @@ -141,7 +143,7 @@ static struct timer_of to =3D { > > }, > > }; > > > > -static int __init sprd_timer_init(struct device_node *np) > > +static int sprd_timer_init(struct device_node *np) > > Does the __init annotation really need to be removed ? > > > { > > int ret; > > > > @@ -190,7 +192,7 @@ static struct clocksource suspend_clocksource =3D { > > .flags =3D CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NON= STOP, > > }; > > > > -static int __init sprd_suspend_timer_init(struct device_node *np) > > +static int sprd_suspend_timer_init(struct device_node *np) > > { > > int ret; > > > > @@ -204,6 +206,9 @@ static int __init sprd_suspend_timer_init(struct de= vice_node *np) > > return 0; > > } > > > > -TIMER_OF_DECLARE(sc9860_timer, "sprd,sc9860-timer", sprd_timer_init); > > -TIMER_OF_DECLARE(sc9860_persistent_timer, "sprd,sc9860-suspend-timer", > > - sprd_suspend_timer_init); > > +TIMER_PLATFORM_DRIVER_BEGIN(sprd_timer) > > +TIMER_MATCH("sprd,sc9860-timer", sprd_timer_init) > > +TIMER_MATCH("sprd,sc9860-suspend-timer", sprd_suspend_timer_init) > > +TIMER_PLATFORM_DRIVER_END(sprd_timer); > > Please replace the above by something like: > > TIMER_PLATFORM_DECLARE(sc9860_timer, > "sprd,sc9860-timer", > sprd_timer_init); > > TIMER_PLATFORM_DECLARE(sc9860_persistent_timer, > "sprd,sc9860-suspend-timer", > sprd_suspend_timer_init); > > Without TIMER_PLATFORM_DRIVER_BEGIN/END, and if possible the > MODULE_DESCRIPTION/LICENSE in the TIMER_PLATFORM_DECLARE macro itself. Wrt BEGIN/END macros, Chunyan is just trying to be consistent with what was done for similar macros for IRQ. If you want two separate drivers being registered for this case, that's ok, but the macros should support having multiple compatible strings handled by the same driver. And to do that, you'd need the BEGIN/END variants. -Saravana > The module description could be the first argument of the timer platform > declaration. > > > +MODULE_DESCRIPTION("Unisoc broadcast timer module"); > > +MODULE_LICENSE("GPL"); > > > > -- > Linaro.org =E2=94=82 Open source software for AR= M SoCs > > Follow Linaro: Facebook | > Twitter | > Blog