mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
mailbox: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
This commit is contained in:
parent
81186dc161
commit
5cb5d0c964
@ -33,10 +33,9 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/mailbox_controller.h>
|
||||
#include <linux/mailbox/brcm-message.h>
|
||||
@ -1494,7 +1493,6 @@ static int pdc_dt_read(struct platform_device *pdev, struct pdc_state *pdcs)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *dn = pdev->dev.of_node;
|
||||
const struct of_device_id *match;
|
||||
const int *hw_type;
|
||||
int err;
|
||||
|
||||
@ -1509,11 +1507,9 @@ static int pdc_dt_read(struct platform_device *pdev, struct pdc_state *pdcs)
|
||||
|
||||
pdcs->hw_type = PDC_HW;
|
||||
|
||||
match = of_match_device(of_match_ptr(pdc_mbox_of_match), dev);
|
||||
if (match != NULL) {
|
||||
hw_type = match->data;
|
||||
hw_type = device_get_match_data(dev);
|
||||
if (hw_type)
|
||||
pdcs->hw_type = *hw_type;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <linux/mailbox_controller.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "mailbox.h"
|
||||
@ -403,7 +403,6 @@ MODULE_DEVICE_TABLE(of, sti_mailbox_match);
|
||||
|
||||
static int sti_mbox_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
struct mbox_controller *mbox;
|
||||
struct sti_mbox_device *mdev;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
@ -411,12 +410,11 @@ static int sti_mbox_probe(struct platform_device *pdev)
|
||||
int irq;
|
||||
int ret;
|
||||
|
||||
match = of_match_device(sti_mailbox_match, &pdev->dev);
|
||||
if (!match) {
|
||||
pdev->dev.platform_data = (struct sti_mbox_pdata *)device_get_match_data(&pdev->dev);
|
||||
if (!pdev->dev.platform_data) {
|
||||
dev_err(&pdev->dev, "No configuration found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
pdev->dev.platform_data = (struct sti_mbox_pdata *) match->data;
|
||||
|
||||
mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL);
|
||||
if (!mdev)
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mailbox_controller.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/soc/ti/ti-msgmgr.h>
|
||||
|
||||
#define Q_DATA_OFFSET(proxy, queue, reg) \
|
||||
@ -810,7 +810,6 @@ MODULE_DEVICE_TABLE(of, ti_msgmgr_of_match);
|
||||
static int ti_msgmgr_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct of_device_id *of_id;
|
||||
struct device_node *np;
|
||||
const struct ti_msgmgr_desc *desc;
|
||||
struct ti_msgmgr_inst *inst;
|
||||
@ -828,19 +827,12 @@ static int ti_msgmgr_probe(struct platform_device *pdev)
|
||||
}
|
||||
np = dev->of_node;
|
||||
|
||||
of_id = of_match_device(ti_msgmgr_of_match, dev);
|
||||
if (!of_id) {
|
||||
dev_err(dev, "OF data missing\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
desc = of_id->data;
|
||||
|
||||
inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL);
|
||||
if (!inst)
|
||||
return -ENOMEM;
|
||||
|
||||
inst->dev = dev;
|
||||
inst->desc = desc;
|
||||
inst->desc = desc = device_get_match_data(dev);
|
||||
|
||||
inst->queue_proxy_region =
|
||||
devm_platform_ioremap_resource_byname(pdev, desc->data_region_name);
|
||||
|
Loading…
Reference in New Issue
Block a user