mtd: Use device_get_match_data()
PATCH 1/1 mtd: 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 <[email protected]>
--- drivers/mtd/maps/physmap-core.c | 10 +++------- drivers/mtd/nand/raw/cadence-nand-controller.c | 12 +++++------- drivers/mtd/nand/raw/vf610_nfc.c | 10 ++++------ 3 files changed, 12 insertions(+), 20 deletions(-)
drivers/mtd/maps/physmap-core.c +3 -7
@@ -30,6 +30,7 @@#include <linux/slab.h> #include <linux/device.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h>
@@ -37,7 +38,7 @@#include <linux/mtd/concat.h> #include <linux/mtd/cfi_endian.h> #include <linux/io.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/pm_runtime.h> #include <linux/gpio/consumer.h>
@@ -296,14 +297,9 @@ static const char * const *of_get_part_probes(struct platform_device *dev)static const char *of_select_probe_type (struct platform_device *dev) {struct device_node *dp = dev->dev.of_node; -const struct of_device_id *match;const char *probe_type; - match =of_match_device (of_flash_match, &dev->dev); -if (!match) -return NULL ; - - probe_type = match->data; + probe_type =device_get_match_data (&dev->dev);if (probe_type)return probe_type;
drivers/mtd/nand/raw/cadence-nand-controller.c +5 -7
@@ -15,8 +15,10 @@#include <linux/module.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> -#include <linux/of_device.h> #include <linux/iopoll.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/property.h> #include <linux/slab.h> /*
@@ -2995,15 +2997,11 @@ static int cadence_nand_dt_probe(struct platform_device *ofdev)struct cadence_nand_dt *dt;struct cdns_nand_ctrl *cdns_ctrl;int ret; -const struct of_device_id *of_id;const struct cadence_nand_dt_devdata *devdata;u32 val; - of_id =of_match_device (cadence_nand_dt_ids, &ofdev->dev); -if (of_id) { - ofdev->id_entry = of_id->data; - devdata = of_id->data; - }else { + devdata =device_get_match_data (&ofdev->dev); +if (!devdata) {pr_err ("Failed to find the right device id.\n" );return -ENOMEM ; }
drivers/mtd/nand/raw/vf610_nfc.c +4 -6
@@ -29,8 +29,9 @@#include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> #include <linux/mtd/partitions.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/slab.h> #include <linux/swab.h>
@@ -810,7 +811,6 @@ static int vf610_nfc_probe(struct platform_device *pdev)struct mtd_info *mtd;struct nand_chip *chip;struct device_node *child; -const struct of_device_id *of_id;int err;int irq;
@@ -840,12 +840,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)return PTR_ERR (nfc->clk); } - of_id =of_match_device (vf610_nfc_dt_ids, &pdev->dev); -if (!of_id) + nfc->variant = (enum vf610_nfc_variant )device_get_match_data (&pdev->dev); +if (!nfc->variant)return -ENODEV ; - nfc->variant = (uintptr_t )of_id->data; -for_each_available_child_of_node (nfc->dev->of_node, child) {if (of_device_is_compatible (child,"fsl,vf610-nfc-nandcs" )) {
Signature · 1 line
2.42.0
Quoted 5 lines · Rob Herring
Use preferred
device_get_match_data()instead ofof_match_device()to get the driver match data. With this, adjust the includes to explicitly include the correct headers.Signed-off-by Rob Herring <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/