Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259149
b: refs/heads/master
c: a77ce81
h: refs/heads/master
i:
  259147: 35ddf0a
v: v3
  • Loading branch information
Kumar Gala committed Jul 8, 2011
1 parent 1728979 commit 9dfdda0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3160b09796129abc9523ea3cd1633b0faba64a02
refs/heads/master: a77ce8167cc1d0370fcb1d79b367d62e050cb2b0
21 changes: 21 additions & 0 deletions trunk/drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ struct device platform_bus = {
};
EXPORT_SYMBOL_GPL(platform_bus);

/**
* arch_setup_pdev_archdata - Allow manipulation of archdata before its used
* @dev: platform device
*
* This is called before platform_device_add() such that any pdev_archdata may
* be setup before the platform_notifier is called. So if a user needs to
* manipulate any relevant information in the pdev_archdata they can do:
*
* platform_devic_alloc()
* ... manipulate ...
* platform_device_add()
*
* And if they don't care they can just call platform_device_register() and
* everything will just work out.
*/
void __weak arch_setup_pdev_archdata(struct platform_device *pdev)
{
}

/**
* platform_get_resource - get a resource for a device
* @dev: platform device
Expand Down Expand Up @@ -173,6 +192,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
pa->pdev.id = id;
device_initialize(&pa->pdev.dev);
pa->pdev.dev.release = platform_device_release;
arch_setup_pdev_archdata(&pa->pdev);
}

return pa ? &pa->pdev : NULL;
Expand Down Expand Up @@ -334,6 +354,7 @@ EXPORT_SYMBOL_GPL(platform_device_del);
int platform_device_register(struct platform_device *pdev)
{
device_initialize(&pdev->dev);
arch_setup_pdev_archdata(pdev);
return platform_device_add(pdev);
}
EXPORT_SYMBOL_GPL(platform_device_register);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/platform_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ extern void platform_device_unregister(struct platform_device *);
extern struct bus_type platform_bus_type;
extern struct device platform_bus;

extern void arch_setup_pdev_archdata(struct platform_device *);
extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
extern int platform_get_irq(struct platform_device *, unsigned int);
extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *);
Expand Down

0 comments on commit 9dfdda0

Please sign in to comment.