[PATCH linux dev-4.7 4/8] ipmi: add an Aspeed BT IPMI BMC driver

Joel Stanley joel at jms.id.au
Thu Nov 3 13:46:04 AEDT 2016


On Thu, Nov 3, 2016 at 11:26 AM, Cyril Bur <cyrilbur at gmail.com> wrote:
>
>> +static int bt_bmc_remove(struct platform_device *pdev)
>> +{
>> +     struct bt_bmc *bt_bmc = dev_get_drvdata(&pdev->dev);
>> +
>> +     misc_deregister(&bt_bmc->miscdev);
>> +     if (!bt_bmc->irq)
>> +             del_timer_sync(&bt_bmc->poll_timer);
>
> The old bt-host driver had:
>        devm_iounmap(&pdev->dev, bt_host->base);
>        devm_kfree(&pdev->dev, bt_host);
>
> Is there kernel magic that means they aren't needed?

Yep. The devm_ api's in the kernel are "managed" (hence the m) by the
driver subsystem. When the driver detaches, all of the resources
allocated with devm_ calls are automatically freed in the order they
were allocated.

 https://www.kernel.org/doc/Documentation/driver-model/devres.txt
 http://haifux.org/lectures/323/haifux-devres.pdf

Cheers,

Joel


More information about the openbmc mailing list