[rt2x00-users] [PATCH 1/2] rt2x00: Use ioremap for SoC devices instead of KSEG1ADDR.

Gertjan van Wingerde gwingerde at gmail.com
Mon Jul 19 18:37:27 AEST 2010


On Mon, Jul 19, 2010 at 10:25 AM, Ivo Van Doorn <ivdoorn at gmail.com> wrote:
> On Mon, Jul 19, 2010 at 10:21 AM, Gertjan van Wingerde
> <gwingerde at gmail.com> wrote:
>> On Mon, Jul 19, 2010 at 8:43 AM, Ivo Van Doorn <ivdoorn at gmail.com> wrote:
>>> On Mon, Jul 19, 2010 at 7:53 AM, Gertjan van Wingerde
>>> <gwingerde at gmail.com> wrote:
>>>> On 07/18/10 22:17, Helmut Schaa wrote:
>>>>> Am Samstag 17 Juli 2010 schrieb Gertjan van Wingerde:
>>>>>> Make the code a bit more portable to architectures that do not support
>>>>>> KSEG1ADDR.
>>>>>>
>>>>>> Signed-off-by: Gertjan van Wingerde <gwingerde at gmail.com>
>>>>>> ---
>>>>>>
>>>>>> Note: Compile tested only, as I do not own a SOC device.
>>>>>
>>>>> One more thing: I guess we'll need a corresponding call to iounmap as well,
>>>>> somewhere in the uninit code ...
>>>>>
>>>>> Helmut
>>>>
>>>> Good point. Find updated patch attached.
>>>>
>>>> Note: Once you tested this to work properly, I'll submit the patches formally.
>>>
>>> I think it should be similar to rt2x00pci:
>>>
>>>        if (rt2x00dev->csr.base) {
>>>                iounmap(rt2x00dev->csr.base);
>>>                rt2x00dev->csr.base = NULL;
>>>        }
>>>
>>> As far as I know iounmap doesn't check the pointer.
>>
>> Yeah, but it doesn't need to. I've made sure that if ioremap fails
>> that then the free_reg function isn't called.
>
> How do you handle incomplete register allocations then?
> In rt2x00{soc,pci}_alloc_reg there are 3 things allocated, where each
> of the three
> things can fail...
>

Incomplete register allocations do result in a call to free_reg, but
in those cases
it is guaranteed that the ioremap call succeeded, so
rt2x00dev->csr.base can never
be NULL when free_reg is being called.

---
Gertjan.




More information about the users mailing list