[PATCH 6/7] iio: magnetometer: yas530: Remove redundant defaults on switch devid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a preparation for adding YAS537 variant.

In function yas5xx_probe(), there is a switch statement checking for device
IDs. If the ID is unknown, it exits with a device error. In later functions,
it's not neccessary to check the validity of the device IDs again.

When adding YAS537 in a later patch, several of such switch statements will be
added. To make it more uniform, the redundant ones in YAS530/532 get herby
removed. This is done in a separate patch for better history control.

Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Jakob Hauser <jahau@xxxxxxxxxxxxxx>
---
 drivers/iio/magnetometer/yamaha-yas530.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index 31637a890b7f..59844e1b794c 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -251,13 +251,9 @@ static int yas5xx_measure(struct yas5xx *yas5xx, u16 *t, u16 *x, u16 *y1, u16 *y
 		*y1 = yas532_extract_axis(&data[4]);
 		*y2 = yas532_extract_axis(&data[6]);
 		break;
-	default:
-		dev_err(yas5xx->dev, "unknown data format\n");
-		ret = -EINVAL;
-		break;
 	}
 
-	return ret;
+	return 0;
 
 out_unlock:
 	mutex_unlock(&yas5xx->lock);
@@ -289,9 +285,6 @@ static s32 yas5xx_linearize(struct yas5xx *yas5xx, u16 val, int axis)
 			/* Elaborate coefficients */
 			coef = yas532ac_coef[axis];
 		break;
-	default:
-		dev_err(yas5xx->dev, "unknown device type\n");
-		return val;
 	}
 	/*
 	 * Linearization formula:
@@ -798,9 +791,6 @@ static int yas5xx_meaure_offsets(struct yas5xx *yas5xx)
 	case YAS532_DEVICE_ID:
 		center = YAS532_DATA_CENTER;
 		break;
-	default:
-		dev_err(yas5xx->dev, "unknown device type\n");
-		return -EINVAL;
 	}
 
 	/*
-- 
2.35.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux