···2929#include <linux/compat.h>3030#include <linux/of.h>3131#include <linux/of_device.h>3232+#include <linux/acpi.h>32333334#include <linux/spi/spi.h>3435#include <linux/spi/spidev.h>···701700MODULE_DEVICE_TABLE(of, spidev_dt_ids);702701#endif703702703703+#ifdef CONFIG_ACPI704704+705705+/* Dummy SPI devices not to be used in production systems */706706+#define SPIDEV_ACPI_DUMMY 1707707+708708+static const struct acpi_device_id spidev_acpi_ids[] = {709709+ /*710710+ * The ACPI SPT000* devices are only meant for development and711711+ * testing. Systems used in production should have a proper ACPI712712+ * description of the connected peripheral and they should also use713713+ * a proper driver instead of poking directly to the SPI bus.714714+ */715715+ { "SPT0001", SPIDEV_ACPI_DUMMY },716716+ { "SPT0002", SPIDEV_ACPI_DUMMY },717717+ { "SPT0003", SPIDEV_ACPI_DUMMY },718718+ {},719719+};720720+MODULE_DEVICE_TABLE(acpi, spidev_acpi_ids);721721+722722+static void spidev_probe_acpi(struct spi_device *spi)723723+{724724+ const struct acpi_device_id *id;725725+726726+ if (!has_acpi_companion(&spi->dev))727727+ return;728728+729729+ id = acpi_match_device(spidev_acpi_ids, &spi->dev);730730+ if (WARN_ON(!id))731731+ return;732732+733733+ if (id->driver_data == SPIDEV_ACPI_DUMMY)734734+ dev_warn(&spi->dev, "do not use this driver in production systems!\n");735735+}736736+#else737737+static inline void spidev_probe_acpi(struct spi_device *spi) {}738738+#endif739739+704740/*-------------------------------------------------------------------------*/705741706742static int spidev_probe(struct spi_device *spi)···756718 WARN_ON(spi->dev.of_node &&757719 !of_match_device(spidev_dt_ids, &spi->dev));758720 }721721+722722+ spidev_probe_acpi(spi);759723760724 /* Allocate driver data */761725 spidev = kzalloc(sizeof(*spidev), GFP_KERNEL);···829789 .driver = {830790 .name = "spidev",831791 .of_match_table = of_match_ptr(spidev_dt_ids),792792+ .acpi_match_table = ACPI_PTR(spidev_acpi_ids),832793 },833794 .probe = spidev_probe,834795 .remove = spidev_remove,