From patchwork Wed Oct 11 12:31:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9999539 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1C1E602BF for ; Wed, 11 Oct 2017 12:31:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2466289C2 for ; Wed, 11 Oct 2017 12:31:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A71B7289D0; Wed, 11 Oct 2017 12:31:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16D6F289C2 for ; Wed, 11 Oct 2017 12:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbdJKMb5 (ORCPT ); Wed, 11 Oct 2017 08:31:57 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:39380 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948AbdJKMb5 (ORCPT ); Wed, 11 Oct 2017 08:31:57 -0400 Received: from ayla.of.borg ([84.195.106.246]) by baptiste.telenet-ops.be with bizsmtp id LCXv1w00A5JzmfG01CXvSw; Wed, 11 Oct 2017 14:31:56 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1e2GB1-0004qC-9u; Wed, 11 Oct 2017 14:31:55 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1e2GB1-0004i8-7g; Wed, 11 Oct 2017 14:31:55 +0200 From: Geert Uytterhoeven To: Chris Brandt , Jacopo Mondi Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC] clocksource/drivers/ostm: Use unique device name instead of ostm Date: Wed, 11 Oct 2017 14:31:53 +0200 Message-Id: <1507725113-18070-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently all OSTM devices are called "ostm", also in kernel messages. As there can be multiple instances in an SoC, this can confuse the user. Hence construct a unique name from the DT node name, like is done for platform devices. On GR-Peach, the boot log changes like: -clocksource: ostm: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 57352151442 ns +clocksource: ostm timer@fcfec000: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 57352151442 ns sched_clock: 32 bits at 33MHz, resolution 30ns, wraps every 64440619504ns -ostm: used for clocksource -ostm: used for clock events +ostm timer@fcfec000: used for clocksource +ostm timer@fcfec400: used for clock events Signed-off-by: Geert Uytterhoeven --- Untested due to lack of hardware (I even made up the boot log ;-), hence sent to a limited audience. --- drivers/clocksource/renesas-ostm.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c index 6cffd7c6001a6961..f9080de0a63c5f60 100644 --- a/drivers/clocksource/renesas-ostm.c +++ b/drivers/clocksource/renesas-ostm.c @@ -37,6 +37,7 @@ struct ostm_device { void __iomem *base; unsigned long ticks_per_jiffy; struct clock_event_device ced; + char name[0]; }; static void __iomem *system_clock; /* For sched_clock() */ @@ -88,9 +89,8 @@ static int __init ostm_init_clksrc(struct ostm_device *ostm, unsigned long rate) writeb(CTL_FREERUN, ostm->base + OSTM_CTL); writeb(TS, ostm->base + OSTM_TS); - return clocksource_mmio_init(ostm->base + OSTM_CNT, - "ostm", rate, - 300, 32, clocksource_mmio_readl_up); + return clocksource_mmio_init(ostm->base + OSTM_CNT, ostm->name, rate, + 300, 32, clocksource_mmio_readl_up); } static u64 notrace ostm_read_sched_clock(void) @@ -170,15 +170,14 @@ static int __init ostm_init_clkevt(struct ostm_device *ostm, int irq, struct clock_event_device *ced = &ostm->ced; int ret = -ENXIO; - ret = request_irq(irq, ostm_timer_interrupt, - IRQF_TIMER | IRQF_IRQPOLL, - "ostm", ostm); + ret = request_irq(irq, ostm_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, + ostm->name, ostm); if (ret) { - pr_err("ostm: failed to request irq\n"); + pr_err("%s: failed to request irq\n", ostm->name); return ret; } - ced->name = "ostm"; + ced->name = ostm->name; ced->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC; ced->set_state_shutdown = ostm_shutdown; ced->set_state_periodic = ostm_set_periodic; @@ -194,38 +193,41 @@ static int __init ostm_init_clkevt(struct ostm_device *ostm, int irq, static int __init ostm_init(struct device_node *np) { + unsigned int n = sizeof("ostm ") + strlen(np->name); struct ostm_device *ostm; int ret = -EFAULT; struct clk *ostm_clk = NULL; int irq; unsigned long rate; - ostm = kzalloc(sizeof(*ostm), GFP_KERNEL); + ostm = kzalloc(sizeof(*ostm) + n, GFP_KERNEL); if (!ostm) return -ENOMEM; + snprintf(ostm->name, n, "ostm %s", np->name); + ostm->base = of_iomap(np, 0); if (!ostm->base) { - pr_err("ostm: failed to remap I/O memory\n"); + pr_err("%s: failed to remap I/O memory\n", ostm->name); goto err; } irq = irq_of_parse_and_map(np, 0); if (irq < 0) { - pr_err("ostm: Failed to get irq\n"); + pr_err("%s: Failed to get irq\n", ostm->name); goto err; } ostm_clk = of_clk_get(np, 0); if (IS_ERR(ostm_clk)) { - pr_err("ostm: Failed to get clock\n"); + pr_err("%s: Failed to get clock\n", ostm->name); ostm_clk = NULL; goto err; } ret = clk_prepare_enable(ostm_clk); if (ret) { - pr_err("ostm: Failed to enable clock\n"); + pr_err("%s: Failed to enable clock\n", ostm->name); goto err; } @@ -241,14 +243,14 @@ static int __init ostm_init(struct device_node *np) if (!ret) { ostm_init_sched_clock(ostm, rate); - pr_info("ostm: used for clocksource\n"); + pr_info("%s: used for clocksource\n", ostm->name); } } else { ret = ostm_init_clkevt(ostm, irq, rate); if (!ret) - pr_info("ostm: used for clock events\n"); + pr_info("%s: used for clock events\n", ostm->name); } err: