net: DCB: Validate DCB_ATTR_DCB_BUFFER argument
[linux/fpc-iii.git] / drivers / mtd / spi-nor / intel-spi-platform.c
blobf80f1086f928cf1792afd24272bd62ca214d85af
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Intel PCH/PCU SPI flash platform driver.
5 * Copyright (C) 2016, Intel Corporation
6 * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
7 */
9 #include <linux/ioport.h>
10 #include <linux/module.h>
11 #include <linux/platform_device.h>
13 #include "intel-spi.h"
15 static int intel_spi_platform_probe(struct platform_device *pdev)
17 struct intel_spi_boardinfo *info;
18 struct intel_spi *ispi;
19 struct resource *mem;
21 info = dev_get_platdata(&pdev->dev);
22 if (!info)
23 return -EINVAL;
25 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
26 ispi = intel_spi_probe(&pdev->dev, mem, info);
27 if (IS_ERR(ispi))
28 return PTR_ERR(ispi);
30 platform_set_drvdata(pdev, ispi);
31 return 0;
34 static int intel_spi_platform_remove(struct platform_device *pdev)
36 struct intel_spi *ispi = platform_get_drvdata(pdev);
38 return intel_spi_remove(ispi);
41 static struct platform_driver intel_spi_platform_driver = {
42 .probe = intel_spi_platform_probe,
43 .remove = intel_spi_platform_remove,
44 .driver = {
45 .name = "intel-spi",
49 module_platform_driver(intel_spi_platform_driver);
51 MODULE_DESCRIPTION("Intel PCH/PCU SPI flash platform driver");
52 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
53 MODULE_LICENSE("GPL v2");
54 MODULE_ALIAS("platform:intel-spi");