All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Tresidder <rtresidd@tresar-electronics.com.au>
To: Steven Toth <stoth@kernellabs.com>
Cc: Linux-Media <linux-media@vger.kernel.org>
Subject: Re: Hauppauge WinTV-HVR2205 driver feedback
Date: Mon, 5 Oct 2015 23:26:32 +0800	[thread overview]
Message-ID: <561296A8.7000302@tresar-electronics.com.au> (raw)
In-Reply-To: <CALzAhNVDYgBbCfW5XSwVXJKqm7CgB23=xpsf25Y2Z0yY=tEKBQ@mail.gmail.com>

stage 1..
Yep it works with accessing src directly.. had to reboot to verify that one.
Well at least the download says it worked and the image booted successfully.

excuse my manual diff method..
git and I don't agree... not sure how to get it to diff the media_build 
repo I pulled the code from..
my brain is stuck in subversion mode..

Still rebuilding the kernel to check the i2c Mux issue..

Regards
    Richard

saa7164-fw.c.patch
******************************************************************
--- saa7164-fw.c    2015-10-05 23:05:31.279329924 +0800
+++ saa7164-fw.c    2015-10-05 23:21:54.236082009 +0800
@@ -75,7 +75,6 @@ static int saa7164_downloadimage(struct
                   u32 dlflags, u8 __iomem *dst, u32 dstsize)
  {
      u32 reg, timeout, offset;
-    u8 *srcbuf = NULL;
      int ret;

      u32 dlflag = dlflags;
@@ -93,17 +92,10 @@ static int saa7164_downloadimage(struct
          goto out;
      }

-    srcbuf = kzalloc(4 * 1048576, GFP_KERNEL);
-    if (NULL == srcbuf) {
-        ret = -ENOMEM;
-        goto out;
-    }
-
      if (srcsize > (4*1048576)) {
          ret = -ENOMEM;
          goto out;
      }
-    memcpy(srcbuf, src, srcsize);

      dprintk(DBGLVL_FW, "%s() dlflag = 0x%x\n", __func__, dlflag);
      dprintk(DBGLVL_FW, "%s() dlflag_ack = 0x%x\n", __func__, dlflag_ack);
@@ -134,8 +126,9 @@ static int saa7164_downloadimage(struct
      for (offset = 0; srcsize > dstsize;
          srcsize -= dstsize, offset += dstsize) {

+
          dprintk(DBGLVL_FW, "%s() memcpy %d\n", __func__, dstsize);
-        memcpy_toio(dst, srcbuf + offset, dstsize);
+        memcpy_toio(dst, src+offset, dstsize);

          /* Flag the data as ready */
          saa7164_writel(drflag, 1);
@@ -153,7 +146,7 @@ static int saa7164_downloadimage(struct

      dprintk(DBGLVL_FW, "%s() memcpy(l) %d\n", __func__, dstsize);
      /* Write last block to the device */
-    memcpy_toio(dst, srcbuf+offset, srcsize);
+    memcpy_toio(dst, src+offset, srcsize);

      /* Flag the data as ready */
      saa7164_writel(drflag, 1);
@@ -192,7 +185,6 @@ static int saa7164_downloadimage(struct
      ret = 0;

  out:
-    kfree(srcbuf);
      return ret;
  }
  *********************************************************************


On 05/10/15 22:43, Steven Toth wrote:
>>> Do you have a large number of other devices / drivers loaded? I
>>> suspect another driver is burning through kernel memory before the
>>> saa7164 has a chance to be initialized.
>> Nope nothing I can see Its actually the only addon card I have in this
>> system..
>> I'd be buggered If 4GB of RAM is fragmented enough early on in the boot
>> stage...?
> I agree.
>
>> I've hunted but can't find a nice way to determine what contiguous blocks
>> are available..
>> Noted there was a simple module that could be compiled in to test such
>> things, I'll play with that and see what it turns up..
> Let us know how that goes.
>
>>> I took a quick look at saa7164-fw.c this morning, I see no reason why
>>> the allocation is required at all. With a small patch the function
>>> could be made to memcpy from 'src' directly, dropping the need to
>>> allocate srcbuf what-so-ever. This would remove the need for the 4MB
>>> temporary allocation, and might get you past this issue, likely on to
>>> the next (user buffer allocations are also large - as I recall). Note
>>> that the 4MB allocation is temporary, so its not a long term saving,
>>> but it might get you past the hump.
>> That was my thoughts exactly.. but I took a minimal fiddling approach to
>> begin with..
>> I wasn't sure if there was some requirement for the memcpy_toio requiring a
>> specially allocated source..? can't see why..
>> Was going to dig into that next as a side job..
> At this stage the code is 7-8 years old, so I don't recall the
> rationale for why I did that back in 2008(?) - but looking at it
> today, I think its needless.... and its a fairly trivial thing to
> remove and test.
>


  reply	other threads:[~2015-10-05 15:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-04  4:55 Hauppauge WinTV-HVR2205 driver feedback Richard Tresidder
2015-10-04 14:03 ` Steven Toth
2015-10-05  1:59   ` Richard Tresidder
2015-10-05 14:22     ` Steven Toth
2015-10-05 14:35       ` Richard Tresidder
2015-10-05 14:39         ` Richard Tresidder
2015-10-05 14:43         ` Steven Toth
2015-10-05 15:26           ` Richard Tresidder [this message]
2015-10-05 15:32             ` Steven Toth
2015-10-05 12:45 ` Tycho Lürsen
2015-10-05 14:22   ` Richard Tresidder
2015-10-05 16:03   ` Richard Tresidder
2015-10-11  6:18   ` Richard Tresidder
2015-10-11  7:33     ` Tycho Lürsen
  -- strict thread matches above, loose matches on Subject: below --
2015-06-03  3:55 Stephen Allan
2015-06-03  7:55 ` Antti Palosaari
2015-06-03  8:02   ` Antti Palosaari
2015-06-03  9:29     ` Olli Salonen
2015-06-03 14:30       ` Steven Toth
2015-06-04 12:46         ` Steven Toth
2015-06-03 15:34       ` Antti Palosaari
2015-06-03 19:08         ` Olli Salonen
2015-06-03 19:46           ` Antti Palosaari
2015-06-04  8:07             ` Olli Salonen
2015-06-04  0:38     ` Stephen Allan
2015-06-04  1:22       ` faulkner-ball
2015-06-03 14:31   ` Steven Toth
2015-06-03 21:50     ` Peter Faulkner-Ball
2015-06-03 22:16       ` Steven Toth

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=561296A8.7000302@tresar-electronics.com.au \
    --to=rtresidd@tresar-electronics.com.au \
    --cc=linux-media@vger.kernel.org \
    --cc=stoth@kernellabs.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.