mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 18:36:00 +00:00
cdd30ebb1b
Clean up the existing export namespace code along the same lines of commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo) to __section("foo")") and for the same reason, it is not desired for the namespace argument to be a macro expansion itself. Scripted using git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file; do awk -i inplace ' /^#define EXPORT_SYMBOL_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /^#define MODULE_IMPORT_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /MODULE_IMPORT_NS/ { $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g"); } /EXPORT_SYMBOL_NS/ { if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) { if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ && $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ && $0 !~ /^my/) { getline line; gsub(/[[:space:]]*\\$/, ""); gsub(/[[:space:]]/, "", line); $0 = $0 " " line; } $0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/, "\\1(\\2, \"\\3\")", "g"); } } { print }' $file; done Requested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc Acked-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
85 lines
1.9 KiB
C
85 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* 3-axis accelerometer driver supporting SPI Bosch-Sensortec accelerometer chip
|
|
* Copyright © 2015 Pengutronix, Markus Pargmann <mpa@pengutronix.de>
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include "bmc150-accel.h"
|
|
|
|
static int bmc150_accel_probe(struct spi_device *spi)
|
|
{
|
|
struct regmap *regmap;
|
|
const char *name = NULL;
|
|
enum bmc150_type type = BOSCH_UNKNOWN;
|
|
const struct spi_device_id *id = spi_get_device_id(spi);
|
|
|
|
regmap = devm_regmap_init_spi(spi, &bmc150_regmap_conf);
|
|
if (IS_ERR(regmap)) {
|
|
dev_err(&spi->dev, "Failed to initialize spi regmap\n");
|
|
return PTR_ERR(regmap);
|
|
}
|
|
|
|
if (id) {
|
|
name = id->name;
|
|
type = id->driver_data;
|
|
}
|
|
|
|
return bmc150_accel_core_probe(&spi->dev, regmap, spi->irq, type, name,
|
|
true);
|
|
}
|
|
|
|
static void bmc150_accel_remove(struct spi_device *spi)
|
|
{
|
|
bmc150_accel_core_remove(&spi->dev);
|
|
}
|
|
|
|
static const struct acpi_device_id bmc150_accel_acpi_match[] = {
|
|
{"BMA0255"},
|
|
{"BMA0280"},
|
|
{"BMA222"},
|
|
{"BMA222E"},
|
|
{"BMA250E"},
|
|
{"BMC150A"},
|
|
{"BMI055A"},
|
|
{"BSBA0150"},
|
|
{ },
|
|
};
|
|
MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
|
|
|
|
static const struct spi_device_id bmc150_accel_id[] = {
|
|
{"bma222"},
|
|
{"bma222e"},
|
|
{"bma250e"},
|
|
{"bma253"},
|
|
{"bma255"},
|
|
{"bma280"},
|
|
{"bmc150_accel"},
|
|
{"bmc156_accel", BOSCH_BMC156},
|
|
{"bmi055_accel"},
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(spi, bmc150_accel_id);
|
|
|
|
static struct spi_driver bmc150_accel_driver = {
|
|
.driver = {
|
|
.name = "bmc150_accel_spi",
|
|
.acpi_match_table = bmc150_accel_acpi_match,
|
|
.pm = &bmc150_accel_pm_ops,
|
|
},
|
|
.probe = bmc150_accel_probe,
|
|
.remove = bmc150_accel_remove,
|
|
.id_table = bmc150_accel_id,
|
|
};
|
|
module_spi_driver(bmc150_accel_driver);
|
|
|
|
MODULE_AUTHOR("Markus Pargmann <mpa@pengutronix.de>");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_DESCRIPTION("BMC150 SPI accelerometer driver");
|
|
MODULE_IMPORT_NS("IIO_BMC150");
|