Re: [PATCH v2 3/4] gpio/tegra: Convert to a platform device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 11, 2011 at 2:29 PM, Olof Johansson <olof@xxxxxxxxx> wrote:
>> @@ -333,28 +336,55 @@ static struct irq_chip tegra_gpio_irq_chip = {
>>   */
>>  static struct lock_class_key gpio_lock_class;
>>
>> -static int __init tegra_gpio_init(void)
>> +static int __init tegra_gpio_probe(struct platform_device *pdev)
>>  {
>> +     struct resource *res;
>>       struct tegra_gpio_bank *bank;
>>       int gpio;
>>       int i;
>>       int j;
>>
>> +     for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
>> +             res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
>> +             if (!res) {
>> +                     dev_err(&pdev->dev, "Missing IRQ resource\n");
>> +                     return -ENODEV;
>> +             }
>> +
>> +             bank = &tegra_gpio_banks[i];
>> +             bank->bank = i;
>> +             bank->irq = res->start;
>> +     }
>> +
>> +     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +     if (!res) {
>> +             dev_err(&pdev->dev, "Missing MEM resource\n");
>> +             return -ENODEV;
>> +     }
>> +
>> +     if (!devm_request_mem_region(&pdev->dev, res->start,
>> +                                  resource_size(res),
>> +                                  dev_name(&pdev->dev))) {
>> +             dev_err(&pdev->dev, "Couldn't request MEM resource\n");
>> +             return -ENODEV;
>> +     }
>> +
>> +     regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
>> +     if (!regs) {
>> +             dev_err(&pdev->dev, "Couldn't ioremap regs\n");
>> +             return -ENODEV;
>
> Should you release the mem region requested above here?

As discussed on irc, this is handled by the driver core in case of
failed probe, so nevermind.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux