All of lore.kernel.org
 help / color / mirror / Atom feed
From: Belisko Marek <marek.belisko@gmail.com>
To: Dan Carpenter <error27@gmail.com>,
	Marek Belisko <marek.belisko@open-nandra.com>,
	gregkh@suse.de, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] staging: ft1000: Fix coding style in write_blk_fifo() function.
Date: Wed, 26 Jan 2011 14:34:59 +0100	[thread overview]
Message-ID: <AANLkTimN4KopQtVL8YaJ6M20RqEEMF5iADap4Jt=i=xo@mail.gmail.com> (raw)
In-Reply-To: <20110126130718.GN2721@bicker>

On Wed, Jan 26, 2011 at 2:07 PM, Dan Carpenter <error27@gmail.com> wrote:
> You didn't introduce it but do you know what the code is trying to do
> here?
>
>        byte_length = word_length * 4;
>
>        if (byte_length % 4)
>                aligncnt = 4 - (byte_length % 4);
>        else
>                aligncnt = 0;
>        byte_length += aligncnt;
>
>        if (byte_length && ((byte_length % 64) == 0))
>                byte_length += 4;
>
>        if (byte_length < 64)
>                byte_length = 68;
>
>
> Apparently the stuff has to be aligned to 4 bytes, but it can't be
> aligned at 64 bytes and it can't be less than 68 bytes long.  The
> part that especially confuses me is why it can't be aligned at 64 bytes.
Yes this code seems little bit confusing but basically this routine send data
to device when firmware code is downloaded. Length which should be send is
asked by device itself (word_length) so maybe it should be somehow
aligned in some cases
(don't know details).  Just to get some idea about length I add some
printk(before 4*word_length
and after byte_length is counted before sending to usb):

Jan 26 14:22:24 linux kernel: [29632.843980] write_blk_fifo: word_length:4
Jan 26 14:22:24 linux kernel: [29632.843984] write_blk_fifo: byte_length:68
Jan 26 14:22:24 linux kernel: [29632.859982] write_blk_fifo: word_length:506
Jan 26 14:22:24 linux kernel: [29632.859986] write_blk_fifo: byte_length:2024
Jan 26 14:22:24 linux kernel: [29632.874984] write_blk_fifo: word_length:505
Jan 26 14:22:24 linux kernel: [29632.874988] write_blk_fifo: byte_length:2020
Jan 26 14:22:24 linux kernel: [29632.890046] write_blk_fifo: word_length:4
Jan 26 14:22:24 linux kernel: [29632.890051] write_blk_fifo: byte_length:68


>
> regards,
> dan carpenter
>

thanks,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

  reply	other threads:[~2011-01-26 13:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26 11:49 [PATCH 1/5] staging: ft1000: Remove unused variables Marek Belisko
2011-01-26 11:49 ` [PATCH 2/5] staging: ft1000: Remove unnecessary assignment Marek Belisko
2011-01-26 11:49 ` [PATCH 3/5] staging: ft1000: Create common function for buffers check Marek Belisko
2011-01-26 11:49 ` [PATCH 4/5] staging: ft1000: Fix coding style in write_blk_fifo() function Marek Belisko
2011-01-26 13:07   ` Dan Carpenter
2011-01-26 13:34     ` Belisko Marek [this message]
2011-01-26 13:43     ` Dan Carpenter
2011-01-26 13:56       ` Belisko Marek
2011-01-26 14:30     ` Dan Carpenter
2011-02-08 13:40       ` Belisko Marek
2011-02-08 16:35         ` Dan Carpenter
2011-02-09  8:27           ` Belisko Marek
2011-02-09 10:07           ` Belisko Marek
2011-02-09 11:08             ` Dan Carpenter
2011-02-09 11:16               ` Belisko Marek
2011-01-26 11:49 ` [PATCH 5/5] staging: ft1000: Fix indentation in scram_dnldr() function Marek Belisko

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='AANLkTimN4KopQtVL8YaJ6M20RqEEMF5iADap4Jt=i=xo@mail.gmail.com' \
    --to=marek.belisko@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marek.belisko@open-nandra.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.