All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cousson, Benoit" <b-cousson@ti.com>
To: Aneesh V <aneesh@ti.com>
Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
Subject: Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
Date: Fri, 17 Feb 2012 14:44:45 +0100	[thread overview]
Message-ID: <4F3E59CD.6050108@ti.com> (raw)
In-Reply-To: <4F3E558A.3060605@ti.com>

Hi Aneesh,

On 2/17/2012 2:26 PM, Aneesh V wrote:
> On Thursday 16 February 2012 10:00 PM, Cousson, Benoit wrote:
>> On 2/4/2012 1:16 PM, Aneesh V wrote:

[...]

>>> +/**
>>> + * struct emif_data - Per device static data for driver's use
>>> + * @duplicate: Whether the DDR devices attached to this EMIF
>>> + * instance are exactly same as that on EMIF1. In
>>> + * this case we can save some memory and processing
>>> + * @temperature_level: Maximum temperature of LPDDR2 devices attached
>>> + * to this EMIF - read from MR4 register. If there
>>> + * are two devices attached to this EMIF, this
>>> + * value is the maximum of the two temperature
>>> + * levels.
>>> + * @irq: IRQ number
>>
>> Do you really need to store the IRQ number?
>
> Yes, I need it right now because setup_interrupts() is called later,
> after the first frequency notification, because that's when I have the
> registers to be programmed on a temperature event. But I am re-thinking
> on this strategy. I will move it back to probe() because other
> interrupts can/should be enabled at probe() time. When I do that I
> won't have to store it anymore and I will remove it.

Yes, I saw the code in a later patch. But in that case you should have 
introduced that attribute in the patch that will use it and not before.

But I do agree, that requesting the interrupt in the probe is probably 
better.

[...]

>>> + emif = kzalloc(sizeof(struct emif_data), GFP_KERNEL);
>>
>> You should use the devm_* version of this API to get the simplify the
>> error handling / removal.
>
> Please note that most of my allocations are happening through
> kmemdup(). kmemdup() doesn't have a devm_* equivalent. So, I have a
> cleanup() function and in the interest of uniformity decided to avoid
> devm_* variants altogether.

I think it still worth using devm_kzalloc + memcopy here instead of 
kmemdup to avoid the cleanup() and simplify as well the error handling.

You might even propose a new devm_kmemdup API if you want.

Regards,
Benoit

WARNING: multiple messages have this Message-ID (diff)
From: "Cousson, Benoit" <b-cousson@ti.com>
To: Aneesh V <aneesh@ti.com>
Cc: <linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<akpm@linux-foundation.org>
Subject: Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
Date: Fri, 17 Feb 2012 14:44:45 +0100	[thread overview]
Message-ID: <4F3E59CD.6050108@ti.com> (raw)
In-Reply-To: <4F3E558A.3060605@ti.com>

Hi Aneesh,

On 2/17/2012 2:26 PM, Aneesh V wrote:
> On Thursday 16 February 2012 10:00 PM, Cousson, Benoit wrote:
>> On 2/4/2012 1:16 PM, Aneesh V wrote:

[...]

>>> +/**
>>> + * struct emif_data - Per device static data for driver's use
>>> + * @duplicate: Whether the DDR devices attached to this EMIF
>>> + * instance are exactly same as that on EMIF1. In
>>> + * this case we can save some memory and processing
>>> + * @temperature_level: Maximum temperature of LPDDR2 devices attached
>>> + * to this EMIF - read from MR4 register. If there
>>> + * are two devices attached to this EMIF, this
>>> + * value is the maximum of the two temperature
>>> + * levels.
>>> + * @irq: IRQ number
>>
>> Do you really need to store the IRQ number?
>
> Yes, I need it right now because setup_interrupts() is called later,
> after the first frequency notification, because that's when I have the
> registers to be programmed on a temperature event. But I am re-thinking
> on this strategy. I will move it back to probe() because other
> interrupts can/should be enabled at probe() time. When I do that I
> won't have to store it anymore and I will remove it.

Yes, I saw the code in a later patch. But in that case you should have 
introduced that attribute in the patch that will use it and not before.

But I do agree, that requesting the interrupt in the probe is probably 
better.

[...]

>>> + emif = kzalloc(sizeof(struct emif_data), GFP_KERNEL);
>>
>> You should use the devm_* version of this API to get the simplify the
>> error handling / removal.
>
> Please note that most of my allocations are happening through
> kmemdup(). kmemdup() doesn't have a devm_* equivalent. So, I have a
> cleanup() function and in the interest of uniformity decided to avoid
> devm_* variants altogether.

I think it still worth using devm_kzalloc + memcopy here instead of 
kmemdup to avoid the cleanup() and simplify as well the error handling.

You might even propose a new devm_kmemdup API if you want.

Regards,
Benoit

  reply	other threads:[~2012-02-17 13:44 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-04 12:16 [RFC PATCH 0/8] Add TI EMIF SDRAM controller driver Aneesh V
2012-02-04 12:16 ` [RFC PATCH 1/8] OMAP4: hwmod: add EMIF hw mod data Aneesh V
2012-02-16 10:02   ` Santosh Shilimkar
2012-02-16 10:27     ` Aneesh V
2012-02-04 12:16 ` [RFC PATCH 2/8] misc: ddr: add LPDDR2 data from JESD209-2 Aneesh V
2012-02-16 10:06   ` Santosh Shilimkar
2012-02-16 10:07   ` Santosh Shilimkar
2012-02-16 10:27     ` Aneesh V
2012-02-16 11:10       ` Alan Cox
2012-02-16 11:25         ` Shilimkar, Santosh
2012-02-16 11:55         ` Aneesh V
2012-02-04 12:16 ` [RFC PATCH 3/8] misc: emif: add register definitions for EMIF Aneesh V
2012-02-16 10:10   ` Santosh Shilimkar
2012-02-16 10:30     ` Aneesh V
2012-02-04 12:16 ` [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver Aneesh V
2012-02-16 10:33   ` Santosh Shilimkar
2012-02-16 11:15     ` Aneesh V
2012-02-16 16:30   ` Cousson, Benoit
2012-02-16 16:30     ` Cousson, Benoit
2012-02-17 13:26     ` Aneesh V
2012-02-17 13:44       ` Cousson, Benoit [this message]
2012-02-17 13:44         ` Cousson, Benoit
2012-02-17 15:27         ` Aneesh V
2012-02-24 11:10     ` Aneesh V
2012-02-24 11:16       ` Cousson, Benoit
2012-02-24 11:16         ` Cousson, Benoit
2012-02-04 12:16 ` [RFC PATCH 5/8] misc: emif: handle frequency and voltage change events Aneesh V
2012-02-16 10:38   ` Santosh Shilimkar
2012-02-16 11:22     ` Aneesh V
2012-02-04 12:16 ` [RFC PATCH 6/8] misc: emif: add interrupt and temperature handling Aneesh V
2012-02-16 10:41   ` Santosh Shilimkar
2012-02-16 11:50     ` Aneesh V
2012-02-04 12:16 ` [RFC PATCH 7/8] misc: emif: add one-time settings Aneesh V
2012-02-16 10:44   ` Santosh Shilimkar
2012-02-16 11:56     ` Aneesh V
2012-02-04 12:16 ` [RFC PATCH 8/8] misc: emif: add debugfs entries for emif Aneesh V
2012-02-16 10:46   ` Santosh Shilimkar
2012-02-16 10:51 ` [RFC PATCH 0/8] Add TI EMIF SDRAM controller driver Santosh Shilimkar
2012-02-16 16:23   ` Greg KH
2012-02-17 13:56     ` Aneesh V
2012-02-17 17:50       ` Greg KH
2012-02-20 14:07         ` Aneesh V

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=4F3E59CD.6050108@ti.com \
    --to=b-cousson@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@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 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.