linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>,
	r.verdejo@samsung.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	nicolas@ndufresne.ca,
	linux-kernel-mentees@lists.linuxfoundation.org,
	"Daniel W. S. Almeida" <dwlsalmeida@gmail.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [Linux-kernel-mentees] [PATCH] media: vidtv: fix build on 32bit architectures
Date: Wed, 16 Sep 2020 09:06:06 +0200	[thread overview]
Message-ID: <CAMuHMdXjA7q-v-mYY9DChC0XQbv9vfW6c3Vfn07-H-FgBr+izA@mail.gmail.com> (raw)
In-Reply-To: <20200916084036.09e8f3c8@coco.lan>

Hi Mauro, Daniel,

On Wed, Sep 16, 2020 at 8:40 AM Mauro Carvalho Chehab
<mchehab@kernel.org> wrote:
> Em Tue, 15 Sep 2020 15:05:09 -0300
> "Daniel W. S. Almeida" <dwlsalmeida@gmail.com> escreveu:
> > From: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
> >
> > Fix the following error for builds on 32bit architectures:
> >
> > ERROR: modpost: "__udivdi3"
> > [drivers/media/test-drivers/vidtv/dvb-vidtv-bridge.ko] undefined!
> >
> > Which is due to 64bit divisions that did not go through the helpers
> > in linux/math64.h
> >
> > As vidtv_mux_check_mux_rate was not operational in its current form,
> > drop the entire function  while it is not fixed properly.
> >
> > For now, call vidtv_mux_pad_with_nulls with a constant number of packets
> > to avoid warnings due to unused functions when building this driver.
> >
> > Fixes: f90cf6079bf67988 ("media: vidtv: add a bridge driver")
> > Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # build-tested

> > --- a/drivers/media/test-drivers/vidtv/vidtv_s302m.c
> > +++ b/drivers/media/test-drivers/vidtv/vidtv_s302m.c
> > @@ -285,12 +285,12 @@ static void vidtv_s302m_compute_pts(struct vidtv_encoder *e)
> >  {
> >       u64 count = e->sample_count;
> >       struct vidtv_access_unit *au = e->access_units;
> > +     u32 duration = CLOCK_UNIT_90KHZ / e->sampling_rate_hz;
> >
> >       while (au) {
> >               count += au->num_samples;
> >
> > -             au->pts = count *
> > -                       CLOCK_UNIT_90KHZ / e->sampling_rate_hz;
> > +             au->pts = count * duration;
>
> That doesn't seem to be the right thing to do here.
>
> Assuming that sampling rate is 48 kHz, you'll
> have duration = 1.875, which would be rounded to 1.
>
> In other words, the above is identical to:
>
>         au->pts = count
>
> Now, I don't know from where that CLOCK_UNIT_90KHZ came from.
>
> If such constant is not needed anymore, just drop it.
>
> If, on the other hand, this is required by the specs, then
> you may need to do a 64 bits division, e. g. using
> div64_u64() or do_div().

As vidtv_encoder.sampling_rate_hz is u32, there's fortunately no need
to use div64_u64() (64-by-64), so div_u64() (64-by-32) is fine.

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
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-09-16  7:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 18:05 [Linux-kernel-mentees] [PATCH] media: vidtv: fix build on 32bit architectures Daniel W. S. Almeida
2020-09-15 19:25 ` Randy Dunlap
2020-09-16  6:40 ` Mauro Carvalho Chehab
2020-09-16  7:06   ` Geert Uytterhoeven [this message]
2020-09-16 13:43     ` Daniel W. S. Almeida

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=CAMuHMdXjA7q-v-mYY9DChC0XQbv9vfW6c3Vfn07-H-FgBr+izA@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=dwlsalmeida@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=r.verdejo@samsung.com \
    --cc=rdunlap@infradead.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).