treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / iio / accel / adxl372_spi.c
blob3ef7e3a4804efb9ff9b834bc04e332b31591b39b
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * ADXL372 3-Axis Digital Accelerometer SPI driver
5 * Copyright 2018 Analog Devices Inc.
6 */
8 #include <linux/module.h>
9 #include <linux/regmap.h>
10 #include <linux/of.h>
11 #include <linux/of_device.h>
12 #include <linux/spi/spi.h>
14 #include "adxl372.h"
16 static const struct regmap_config adxl372_spi_regmap_config = {
17 .reg_bits = 7,
18 .pad_bits = 1,
19 .val_bits = 8,
20 .read_flag_mask = BIT(0),
21 .readable_noinc_reg = adxl372_readable_noinc_reg,
24 static int adxl372_spi_probe(struct spi_device *spi)
26 const struct spi_device_id *id = spi_get_device_id(spi);
27 struct regmap *regmap;
29 regmap = devm_regmap_init_spi(spi, &adxl372_spi_regmap_config);
30 if (IS_ERR(regmap))
31 return PTR_ERR(regmap);
33 return adxl372_probe(&spi->dev, regmap, spi->irq, id->name);
36 static const struct spi_device_id adxl372_spi_id[] = {
37 { "adxl372", 0 },
40 MODULE_DEVICE_TABLE(spi, adxl372_spi_id);
42 static const struct of_device_id adxl372_of_match[] = {
43 { .compatible = "adi,adxl372" },
44 { },
46 MODULE_DEVICE_TABLE(of, adxl372_of_match);
48 static struct spi_driver adxl372_spi_driver = {
49 .driver = {
50 .name = "adxl372_spi",
51 .of_match_table = adxl372_of_match,
53 .probe = adxl372_spi_probe,
54 .id_table = adxl372_spi_id,
57 module_spi_driver(adxl372_spi_driver);
59 MODULE_AUTHOR("Stefan Popa <stefan.popa@analog.com>");
60 MODULE_DESCRIPTION("Analog Devices ADXL372 3-axis accelerometer SPI driver");
61 MODULE_LICENSE("GPL");