Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memory: omap-gpmc: Use a compatible match table when checking for NAND controller

As more compatibles can be added to the GPMC NAND controller driver
use a compatible match table.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20211221131757.2030-4-rogerq@kernel.org
[krzysztof: remove "is_nand" variable]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

authored by

Roger Quadros and committed by
Krzysztof Kozlowski
f2f8115f 7e58accf

+10 -6
+1 -1
drivers/memory/omap-gpmc.c
··· 2183 2183 } 2184 2184 } 2185 2185 2186 - if (of_device_is_compatible(child, "ti,omap2-nand")) { 2186 + if (of_match_node(omap_nand_ids, child)) { 2187 2187 /* NAND specific setup */ 2188 2188 val = 8; 2189 2189 of_property_read_u32(child, "nand-bus-width", &val);
+1 -4
drivers/mtd/nand/raw/omap2.c
··· 2352 2352 return ret; 2353 2353 } 2354 2354 2355 - static const struct of_device_id omap_nand_ids[] = { 2356 - { .compatible = "ti,omap2-nand", }, 2357 - {}, 2358 - }; 2355 + /* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */ 2359 2356 MODULE_DEVICE_TABLE(of, omap_nand_ids); 2360 2357 2361 2358 static struct platform_driver omap_nand_driver = {
+8 -1
include/linux/platform_data/mtd-nand-omap2.h
··· 7 7 #define _MTD_NAND_OMAP2_H 8 8 9 9 #include <linux/mtd/partitions.h> 10 + #include <linux/mod_devicetable.h> 10 11 11 12 #define GPMC_BCH_NUM_REMAINDER 8 12 13 ··· 62 61 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER]; 63 62 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; 64 63 }; 65 - #endif 64 + 65 + static const struct of_device_id omap_nand_ids[] = { 66 + { .compatible = "ti,omap2-nand", }, 67 + {}, 68 + }; 69 + 70 + #endif /* _MTD_NAND_OMAP2_H */