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

Configure Feed

Select the types of activity you want to include in your feed.

at v4.10-rc2 56 lines 1.2 kB view raw
1#include <linux/device.h> 2#include <linux/kernel.h> 3#include <linux/spi/spi.h> 4#include <linux/module.h> 5#include <linux/slab.h> 6#include <linux/regmap.h> 7 8#include "kxsd9.h" 9 10static int kxsd9_spi_probe(struct spi_device *spi) 11{ 12 static const struct regmap_config config = { 13 .reg_bits = 8, 14 .val_bits = 8, 15 .max_register = 0x0e, 16 }; 17 struct regmap *regmap; 18 19 spi->mode = SPI_MODE_0; 20 regmap = devm_regmap_init_spi(spi, &config); 21 if (IS_ERR(regmap)) { 22 dev_err(&spi->dev, "%s: regmap allocation failed: %ld\n", 23 __func__, PTR_ERR(regmap)); 24 return PTR_ERR(regmap); 25 } 26 27 return kxsd9_common_probe(&spi->dev, 28 regmap, 29 spi_get_device_id(spi)->name); 30} 31 32static int kxsd9_spi_remove(struct spi_device *spi) 33{ 34 return kxsd9_common_remove(&spi->dev); 35} 36 37static const struct spi_device_id kxsd9_spi_id[] = { 38 {"kxsd9", 0}, 39 { }, 40}; 41MODULE_DEVICE_TABLE(spi, kxsd9_spi_id); 42 43static struct spi_driver kxsd9_spi_driver = { 44 .driver = { 45 .name = "kxsd9", 46 .pm = &kxsd9_dev_pm_ops, 47 }, 48 .probe = kxsd9_spi_probe, 49 .remove = kxsd9_spi_remove, 50 .id_table = kxsd9_spi_id, 51}; 52module_spi_driver(kxsd9_spi_driver); 53 54MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>"); 55MODULE_DESCRIPTION("Kionix KXSD9 SPI driver"); 56MODULE_LICENSE("GPL v2");