From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-sh@vger.kernel.org, glaubitz@physik.fu-berlin.de
Subject: Re: [RESEND RFC PATCH 07/12] clocksource: Update sh_tmu of handling.
Date: Fri, 01 Sep 2023 22:40:07 +0900 [thread overview]
Message-ID: <87h6oeui4o.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <CAMuHMdU7Yw49pKtHvNazY6ABb+wd=Ee4JYT4DB9Ff2qAkTFinQ@mail.gmail.com>
On Fri, 01 Sep 2023 22:01:51 +0900,
Geert Uytterhoeven wrote:
>
> Hi Sato-san,
>
> On Thu, Aug 31, 2023 at 7:22 PM Yoshinori Sato
> <ysato@users.sourceforge.jp> wrote:
> > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
>
> Thanks for your patch!
>
> > --- a/drivers/clocksource/sh_tmu.c
> > +++ b/drivers/clocksource/sh_tmu.c
> > @@ -420,9 +420,6 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch,
> > ced->suspend = sh_tmu_clock_event_suspend;
> > ced->resume = sh_tmu_clock_event_resume;
> >
> > - dev_info(&ch->tmu->pdev->dev, "ch%u: used for clock events\n",
> > - ch->index);
> > -
>
> Why?
>
> > clockevents_config_and_register(ced, ch->tmu->rate, 0x300, 0xffffffff);
> >
> > ret = request_irq(ch->irq, sh_tmu_interrupt,
> > @@ -500,12 +497,12 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)
> > tmu->model = SH_TMU;
> > tmu->num_channels = 3;
> >
> > - of_property_read_u32(np, "#renesas,channels", &tmu->num_channels);
> > -
> > - if (tmu->num_channels != 2 && tmu->num_channels != 3) {
> > - dev_err(&tmu->pdev->dev, "invalid number of channels %u\n",
> > - tmu->num_channels);
> > - return -EINVAL;
> > + if (of_property_read_u32(np, "#renesas,channels", &tmu->num_channels)) {
> > + if (tmu->num_channels != 2 && tmu->num_channels != 3) {
> > + dev_err(&tmu->pdev->dev,
> > + "invalid number of channels %u\n", tmu->num_channels);
> > + return -EINVAL;
> > + }
>
> Why?
> I understand TMU on SH7751 has 5 channels, so just extended the check?
>
> Note that of_property_read_u32() returns zero on success.
>
> > }
> >
> > return 0;
> > @@ -513,7 +510,6 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)
> >
> > static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
> > {
> > - unsigned int i;
> > int ret;
> >
> > tmu->pdev = pdev;
> > @@ -535,6 +531,11 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
> > return -ENXIO;
> > }
> >
> > + if (tmu->num_channels < 2) {
> > + dev_err(&tmu->pdev->dev, "Invalid channels.\n");
> > + return -ENXIO;
> > + }
> > +
>
> Why?
>
> > /* Get hold of clock. */
> > tmu->clk = clk_get(&tmu->pdev->dev, "fck");
> > if (IS_ERR(tmu->clk)) {
> > @@ -573,12 +574,12 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
> > * Use the first channel as a clock event device and the second channel
> > * as a clock source.
> > */
> > - for (i = 0; i < tmu->num_channels; ++i) {
> > - ret = sh_tmu_channel_setup(&tmu->channels[i], i,
> > - i == 0, i == 1, tmu);
> > - if (ret < 0)
> > - goto err_unmap;
> > - }
> > + ret = sh_tmu_channel_setup(&tmu->channels[0], 0, false, true, tmu);
> > + if (ret < 0)
> > + goto err_unmap;
> > + ret = sh_tmu_channel_setup(&tmu->channels[1], 1, true, false, tmu);
> > + if (ret < 0)
> > + goto err_unmap;
>
> Why, oh why?...
Sorry.
This is the wrong version.
I will update this to the correct one as I will also fix other parts.
> >
> > platform_set_drvdata(pdev, tmu);
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
--
Yosinori Sato
next prev parent reply other threads:[~2023-09-01 13:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 1:11 [RESEND RFC PATCH 00/12] DeviceTree support for SH7751 based boards Yoshinori Sato
2023-08-31 1:11 ` [RESEND RFC PATCH 01/12] sh: Add OF target boards Yoshinori Sato
2023-09-01 12:22 ` Geert Uytterhoeven
2023-09-01 14:26 ` Geert Uytterhoeven
2023-09-06 8:05 ` Yoshinori Sato
2023-09-06 8:12 ` John Paul Adrian Glaubitz
2023-09-07 3:28 ` Yoshinori Sato
2023-09-07 3:35 ` Yoshinori Sato
2023-08-31 1:11 ` [RESEND RFC PATCH 02/12] sh: Update OF handling Yoshinori Sato
2023-09-01 12:25 ` Geert Uytterhoeven
2023-08-31 1:11 ` [RESEND RFC PATCH 03/12] sh: SH4 OF support Yoshinori Sato
2023-09-01 12:26 ` Geert Uytterhoeven
2023-09-13 12:23 ` Geert Uytterhoeven
2023-09-15 9:21 ` Yoshinori Sato
2023-08-31 1:11 ` [RESEND RFC PATCH 04/12] clk: SH7750 / 7751 clk driver Yoshinori Sato
2023-09-01 12:26 ` Geert Uytterhoeven
2023-09-07 3:44 ` Yoshinori Sato
2023-08-31 1:11 ` [RESEND RFC PATCH 05/12] drivers/irqchip: Add SH7751 and boards specific irqchip Yoshinori Sato
2023-09-01 12:49 ` Geert Uytterhoeven
2023-08-31 1:11 ` [RESEND RFC PATCH 06/12] drivers/pci: Add SH7751 PCI Host bridge driver Yoshinori Sato
2023-09-01 12:54 ` Geert Uytterhoeven
2023-08-31 1:11 ` [RESEND RFC PATCH 07/12] clocksource: Update sh_tmu of handling Yoshinori Sato
2023-08-31 6:48 ` Krzysztof Kozlowski
2023-09-01 13:01 ` Geert Uytterhoeven
2023-09-01 13:40 ` Yoshinori Sato [this message]
2023-08-31 1:11 ` [RESEND RFC PATCH 08/12] mfd/sm501: Add OF properties Yoshinori Sato
2023-08-31 6:51 ` Krzysztof Kozlowski
2023-09-01 13:09 ` Geert Uytterhoeven
2023-08-31 1:11 ` [RESEND RFC PATCH 09/12] of: FDT vaddr support for SH Yoshinori Sato
2023-08-31 6:48 ` Krzysztof Kozlowski
2023-09-01 13:11 ` Geert Uytterhoeven
2023-09-01 13:33 ` Yoshinori Sato
2023-08-31 1:11 ` [RESEND RFC PATCH 10/12] serial/sh-sci: Fix earlyprintk / earlycon Yoshinori Sato
2023-09-01 13:26 ` Geert Uytterhoeven
2023-09-06 7:27 ` Yoshinori Sato
2023-08-31 1:11 ` [RESEND RFC PATCH 11/12] sh: target dts Yoshinori Sato
2023-09-01 14:23 ` Geert Uytterhoeven
2023-08-31 1:11 ` [RESEND RFC PATCH 12/12] sh: OF defconfig Yoshinori Sato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6oeui4o.wl-ysato@users.sourceforge.jp \
--to=ysato@users.sourceforge.jp \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).