summaryrefslogtreecommitdiff
path: root/drivers/mfd/sm501.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-11 17:20:17 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-11 17:20:17 +0300
commit883cad5ba8cc2d9b740b4ad0a8a91063c99c75a3 (patch)
treef91886f6747bbcf239c42cd1c8d55f86f546e8e7 /drivers/mfd/sm501.c
parent8d08c0554244f95076cfe2a722e5207d974cd92d (diff)
parent556c242045f0c1613aac2e64dc5b2ff0e4bc89e1 (diff)
downloadlinux-883cad5ba8cc2d9b740b4ad0a8a91063c99c75a3.tar.xz
Merge tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Device Support: - Add support for AXP813 ADC to AXP20x - Add support for PM8005, PM8998 and PMI8998 New Functionality: - Add support for Battery Power Supply to AXP813 - Add support for SYSCON to SPARD SC27XX SPI - Add support for RTC to ChromeOS Embedded-Controller Fix-ups: - Remove unused code; exynos{4,5}-pmu, cros_ec, cros_ec_acpi_gpe - Remove duplicate error messages (-ENOMEM, etc); htc-i2cpld, janz-cmodio, max8997, rc5t583, sm501, smsc-ece1099, abx500-core, si476x-i2c, ti_am335x_tscadc, tps65090, tps6586x, tps65910, tps80031, twl6030-irq, viperboard - Succinctly use ptr to struct in sizeof(); rc5t583, abx500-core, sm501, smsc-ece1099 - Simplify syntax for NULL ptr checking; abx500-core, sm501 - No not unnecessarily initialise variables; tps65910, tps65910 - Reorganise and simplify driver data; omap-usb-tll - Move to SPDX license statement; tps68470 - Probe ADCs via DT; axp20x - Use new GPIOD API; arizona-core - Constify things; axp20x - Reduce code-size (use MACROS, etc); axp20x, omap-usb-host - Add DT support/docs; motorola-cpcap - Remove VLAs; rave-sp - Use devm_* managed resources; cros_ec - Interrogate HW for firmware version; rave-sp - Provide ACPI support for ChromeOS Embedded-Controller Bug Fixes: - Reorder ordered (enum) device list; tps65218 - Only accept valid data from the offset; rave-sp - Refrain from copying junk from failed SPI read; cros_ec_dev - Fix potential memory leaks; pcf50633-core - Fix clock initialisation; twl-core - Fix build-issue; tps65911 - Fix off-by-one error; tps65911 - Fix code ordering issues; intel-lpss - Fix COMPILE_TEST related issues; pwm-stm32 - Fix broken MMC card detection; asic3 - Fix clocking related issues; intel-lpss-pci" * tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (84 commits) mfd: cros_ec: Remove unused __remove function mfd: wm97xx-core: Platform data can be NULL mfd: cros_ec_dev: Don't advertise junk features on failure mfd: cros_ec: Use devm_kzalloc for private data mfd: intel-lpss: Fix Intel Cannon Lake LPSS I2C input clock mfd: asic3: Fix broken MMC card detection mfd: timberdale: Fix spelling mistake "Uknown" -> "Unknown" mfd: omap-usb-host: Use match_string() helper mfd: stm32-timers: Fix pwm-stm32 linker issue with COMPILE_TEST pwm: stm32: Initialize raw local variables mfd: arizona: Update DT doc to support more standard Reset binding dt-bindings: mfd: Add bindings for DA9063L mfd: intel-lpss: Correct names of RESETS register bits mfd: qcom-spmi-pmic: Add support for pm8005, pm8998 and pmi8998 mfd: intel-lpss: Program REMAP register in PIO mode mfd: cros_ec_i2c: Moving the system sleep pm ops to late mfd: cros_ec_i2c: Add ACPI module device table mfd: cros_ec_dev: Register shutdown function for debugfs mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice mfd: cros_ec: Don't try to grab log when suspended ...
Diffstat (limited to 'drivers/mfd/sm501.c')
-rw-r--r--drivers/mfd/sm501.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index ad774161a22d..55d19fd0994e 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1050,13 +1050,13 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
spin_lock_init(&gpio->lock);
gpio->regs_res = request_mem_region(iobase, 0x20, "sm501-gpio");
- if (gpio->regs_res == NULL) {
+ if (!gpio->regs_res) {
dev_err(sm->dev, "gpio: failed to request region\n");
return -ENXIO;
}
gpio->regs = ioremap(iobase, 0x20);
- if (gpio->regs == NULL) {
+ if (!gpio->regs) {
dev_err(sm->dev, "gpio: failed to remap registers\n");
ret = -ENXIO;
goto err_claimed;
@@ -1358,7 +1358,7 @@ static int sm501_init_dev(struct sm501_devdata *sm)
sm501_register_gpio(sm);
}
- if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) {
+ if (pdata && pdata->gpio_i2c && pdata->gpio_i2c_nr > 0) {
if (!sm501_gpio_isregistered(sm))
dev_err(sm->dev, "no gpio available for i2c gpio.\n");
else
@@ -1383,9 +1383,8 @@ static int sm501_plat_probe(struct platform_device *dev)
struct sm501_devdata *sm;
int ret;
- sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
- if (sm == NULL) {
- dev_err(&dev->dev, "no memory for device data\n");
+ sm = kzalloc(sizeof(*sm), GFP_KERNEL);
+ if (!sm) {
ret = -ENOMEM;
goto err1;
}
@@ -1403,8 +1402,7 @@ static int sm501_plat_probe(struct platform_device *dev)
sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-
- if (sm->io_res == NULL || sm->mem_res == NULL) {
+ if (!sm->io_res || !sm->mem_res) {
dev_err(&dev->dev, "failed to get IO resource\n");
ret = -ENOENT;
goto err_res;
@@ -1412,8 +1410,7 @@ static int sm501_plat_probe(struct platform_device *dev)
sm->regs_claim = request_mem_region(sm->io_res->start,
0x100, "sm501");
-
- if (sm->regs_claim == NULL) {
+ if (!sm->regs_claim) {
dev_err(&dev->dev, "cannot claim registers\n");
ret = -EBUSY;
goto err_res;
@@ -1422,8 +1419,7 @@ static int sm501_plat_probe(struct platform_device *dev)
platform_set_drvdata(dev, sm);
sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
-
- if (sm->regs == NULL) {
+ if (!sm->regs) {
dev_err(&dev->dev, "cannot remap registers\n");
ret = -EIO;
goto err_claim;
@@ -1449,7 +1445,7 @@ static void sm501_set_power(struct sm501_devdata *sm, int on)
{
struct sm501_platdata *pd = sm->platdata;
- if (pd == NULL)
+ if (!pd)
return;
if (pd->get_power) {
@@ -1573,9 +1569,8 @@ static int sm501_pci_probe(struct pci_dev *dev,
struct sm501_devdata *sm;
int err;
- sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
- if (sm == NULL) {
- dev_err(&dev->dev, "no memory for device data\n");
+ sm = kzalloc(sizeof(*sm), GFP_KERNEL);
+ if (!sm) {
err = -ENOMEM;
goto err1;
}
@@ -1626,15 +1621,14 @@ static int sm501_pci_probe(struct pci_dev *dev,
sm->regs_claim = request_mem_region(sm->io_res->start,
0x100, "sm501");
- if (sm->regs_claim == NULL) {
+ if (!sm->regs_claim) {
dev_err(&dev->dev, "cannot claim registers\n");
err= -EBUSY;
goto err3;
}
sm->regs = pci_ioremap_bar(dev, 1);
-
- if (sm->regs == NULL) {
+ if (!sm->regs) {
dev_err(&dev->dev, "cannot remap registers\n");
err = -EIO;
goto err4;