All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Shaik Ameer Basha <shaik.ameer@samsung.com>
Cc: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	linux-media@vger.kernel.org, sungchun.kang@samsung.com,
	khw0178.kim@samsung.com, mchehab@infradead.org,
	laurent.pinchart@ideasonboard.com, sy0816.kang@samsung.com,
	s.nawrocki@samsung.com, posciak@google.com,
	alim.akhtar@gmail.com, prashanth.g@samsung.com,
	joshi@samsung.com, ameersk@gmail.com
Subject: Re: [PATCH v2 01/01] media: gscaler: Add new driver for generic scaler
Date: Thu, 12 Jul 2012 01:44:19 +0200	[thread overview]
Message-ID: <4FFE0FD3.7020604@gmail.com> (raw)
In-Reply-To: <4FFE00B2.2040906@gmail.com>

On 07/12/2012 12:39 AM, Sylwester Nawrocki wrote:
>> +int gsc_hw_get_input_buf_mask_status(struct gsc_dev *dev)
>> +{
>> +	u32 cfg, status, bits = 0;
>> +
>> +	cfg = readl(dev->regs + GSC_IN_BASE_ADDR_Y_MASK);

	return hweight32(cfg & GSC_IN_BASE_ADDR_MASK);

>> +	status = cfg&   GSC_IN_BASE_ADDR_MASK;
>> +	while (status) {
>> +		status = status&   (status - 1);
>> +		bits++;
>> +	}
>> +	return bits;
>> +}
[...]
>> +
>> +int gsc_hw_get_nr_unmask_bits(struct gsc_dev *dev)
>> +{
>> +	u32 bits = 0;
>> +	u32 mask_bits = readl(dev->regs + GSC_OUT_BASE_ADDR_Y_MASK);
>
> Care to add an empty line? It might also look better to order
> declarations in decending line order.
>
>> +	mask_bits&= GSC_OUT_BASE_ADDR_MASK;
>> +
>> +	while (mask_bits) {
>> +		mask_bits = mask_bits&   (mask_bits - 1);
>> +		bits++;
>> +	}

It seems you are computing a Hamming weight here, then it could
be simplified to a built-in function:

	bits = hweight32(mask_bits);

But it's not quite clear to me, why you're subtracting it
from 16 ?

>> +	bits = 16 - bits;
>
> return 16 - bits;
>
>> +
>> +	return bits;
>> +}

  reply	other threads:[~2012-07-11 23:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 10:27 [PATCH v2 00/01] Add new driver for generic scaler Shaik Ameer Basha
2012-07-05 10:27 ` [PATCH v2 01/01] media: gscaler: " Shaik Ameer Basha
2012-07-11 17:52   ` Pawel Osciak
2012-07-24  9:30     ` Shaik Ameer Basha
2012-07-11 22:39   ` Sylwester Nawrocki
2012-07-11 23:44     ` Sylwester Nawrocki [this message]
2012-07-12 19:09   ` Sylwester Nawrocki
2012-07-23  6:18     ` Shaik Ameer Basha
2012-07-23 18:35       ` Sylwester Nawrocki

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=4FFE0FD3.7020604@gmail.com \
    --to=sylvester.nawrocki@gmail.com \
    --cc=alim.akhtar@gmail.com \
    --cc=ameersk@gmail.com \
    --cc=joshi@samsung.com \
    --cc=khw0178.kim@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=posciak@google.com \
    --cc=prashanth.g@samsung.com \
    --cc=s.nawrocki@samsung.com \
    --cc=shaik.ameer@samsung.com \
    --cc=sungchun.kang@samsung.com \
    --cc=sy0816.kang@samsung.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.