[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SJ2P222MB10432CABF7A18C3A7F7ED9FCBC752@SJ2P222MB1043.NAMP222.PROD.OUTLOOK.COM>
Date: Sat, 28 Sep 2024 23:35:55 -0700
From: Manuel Quintero F <sakunix@...mail.com>
To: erick.archer@...look.com
Cc: linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Manuel Quintero F <sakunix@...mail.com>
Subject: [PATCH 100/100] Input: joystick: a3d: fixed multiple coding style
Fixed multiple coding styles issue
Signed-off-by: Manuel Quintero F <sakunix@...mail.com>
---
drivers/input/joystick/a3d.c | 91 +++++++++++++++++++-----------------
1 file changed, 47 insertions(+), 44 deletions(-)
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c
index 15182f16ed19..8923c58d2288 100644
--- a/drivers/input/joystick/a3d.c
+++ b/drivers/input/joystick/a3d.c
@@ -97,57 +97,57 @@ static void a3d_read(struct a3d *a3d, unsigned char *data)
switch (a3d->mode) {
- case A3D_MODE_A3D:
- case A3D_MODE_OEM:
- case A3D_MODE_PAN:
+ case A3D_MODE_A3D:
+ case A3D_MODE_OEM:
+ case A3D_MODE_PAN:
- input_report_rel(dev, REL_X, ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7));
- input_report_rel(dev, REL_Y, ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7));
+ input_report_rel(dev, REL_X, ((data[5] << 6) | (data[6] << 3) | data[7]) - ((data[5] & 4) << 7));
+ input_report_rel(dev, REL_Y, ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7));
- input_report_key(dev, BTN_RIGHT, data[2] & 1);
- input_report_key(dev, BTN_LEFT, data[3] & 2);
- input_report_key(dev, BTN_MIDDLE, data[3] & 4);
+ input_report_key(dev, BTN_RIGHT, data[2] & 1);
+ input_report_key(dev, BTN_LEFT, data[3] & 2);
+ input_report_key(dev, BTN_MIDDLE, data[3] & 4);
- input_sync(dev);
+ input_sync(dev);
- a3d->axes[0] = ((signed char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128;
- a3d->axes[1] = ((signed char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128;
- a3d->axes[2] = ((signed char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128;
- a3d->axes[3] = ((signed char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128;
+ a3d->axes[0] = ((signed char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128;
+ a3d->axes[1] = ((signed char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128;
+ a3d->axes[2] = ((signed char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128;
+ a3d->axes[3] = ((signed char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128;
- a3d->buttons = ((data[3] << 3) | data[4]) & 0xf;
+ a3d->buttons = ((data[3] << 3) | data[4]) & 0xf;
- break;
+ break;
- case A3D_MODE_PXL:
+ case A3D_MODE_PXL:
- input_report_rel(dev, REL_X, ((data[ 9] << 6) | (data[10] << 3) | data[11]) - ((data[ 9] & 4) << 7));
- input_report_rel(dev, REL_Y, ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7));
+ input_report_rel(dev, REL_X, ((data[9] << 6) | (data[10] << 3) | data[11]) - ((data[9] & 4) << 7));
+ input_report_rel(dev, REL_Y, ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7));
- input_report_key(dev, BTN_RIGHT, data[2] & 1);
- input_report_key(dev, BTN_LEFT, data[3] & 2);
- input_report_key(dev, BTN_MIDDLE, data[3] & 4);
- input_report_key(dev, BTN_SIDE, data[7] & 2);
- input_report_key(dev, BTN_EXTRA, data[7] & 4);
+ input_report_key(dev, BTN_RIGHT, data[2] & 1);
+ input_report_key(dev, BTN_LEFT, data[3] & 2);
+ input_report_key(dev, BTN_MIDDLE, data[3] & 4);
+ input_report_key(dev, BTN_SIDE, data[7] & 2);
+ input_report_key(dev, BTN_EXTRA, data[7] & 4);
- input_report_abs(dev, ABS_X, ((signed char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128);
- input_report_abs(dev, ABS_Y, ((signed char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128);
- input_report_abs(dev, ABS_RUDDER, ((signed char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128);
- input_report_abs(dev, ABS_THROTTLE, ((signed char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128);
+ input_report_abs(dev, ABS_X, ((signed char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128);
+ input_report_abs(dev, ABS_Y, ((signed char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128);
+ input_report_abs(dev, ABS_RUDDER, ((signed char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128);
+ input_report_abs(dev, ABS_THROTTLE, ((signed char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128);
- input_report_abs(dev, ABS_HAT0X, ( data[5] & 1) - ((data[5] >> 2) & 1));
- input_report_abs(dev, ABS_HAT0Y, ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1));
- input_report_abs(dev, ABS_HAT1X, ((data[4] >> 1) & 1) - ( data[3] & 1));
- input_report_abs(dev, ABS_HAT1Y, ((data[4] >> 2) & 1) - ( data[4] & 1));
+ input_report_abs(dev, ABS_HAT0X, (data[5] & 1) - ((data[5] >> 2) & 1));
+ input_report_abs(dev, ABS_HAT0Y, ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1));
+ input_report_abs(dev, ABS_HAT1X, ((data[4] >> 1) & 1) - (data[3] & 1));
+ input_report_abs(dev, ABS_HAT1Y, ((data[4] >> 2) & 1) - (data[4] & 1));
- input_report_key(dev, BTN_TRIGGER, data[8] & 1);
- input_report_key(dev, BTN_THUMB, data[8] & 2);
- input_report_key(dev, BTN_TOP, data[8] & 4);
- input_report_key(dev, BTN_PINKIE, data[7] & 1);
+ input_report_key(dev, BTN_TRIGGER, data[8] & 1);
+ input_report_key(dev, BTN_THUMB, data[8] & 2);
+ input_report_key(dev, BTN_TOP, data[8] & 4);
+ input_report_key(dev, BTN_PINKIE, data[7] & 1);
- input_sync(dev);
+ input_sync(dev);
- break;
+ break;
}
}
@@ -275,8 +275,8 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
a3d->mode = data[0];
if (!a3d->mode || a3d->mode > 5) {
- printk(KERN_WARNING "a3d.c: Unknown A3D device detected "
- "(%s, id=%d), contact <vojtech@....cz>\n", gameport->phys, a3d->mode);
+ pr_warn("a3d.c: Unknown A3D device detected (%s, id=%d), contact <vojtech@....cz>\n",
+ gameport->phys, a3d->mode);
err = -ENODEV;
goto fail2;
}
@@ -339,8 +339,10 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
a3d_read(a3d, data);
- if (!(a3d->adc = adc = gameport_allocate_port()))
- printk(KERN_ERR "a3d: Not enough memory for ADC port\n");
+ a3d->adc = adc = gameport_allocate_port();
+
+ if (!(a3d->adc))
+ pr_err("a3d: Not enough memory for ADC port\n");
else {
adc->port_data = a3d;
adc->open = a3d_adc_open;
@@ -362,10 +364,11 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
return 0;
- fail3: if (a3d->adc)
+fail3:
+ if (a3d->adc)
gameport_unregister_port(a3d->adc);
- fail2: gameport_close(gameport);
- fail1: gameport_set_drvdata(gameport, NULL);
+fail2: gameport_close(gameport);
+fail1: gameport_set_drvdata(gameport, NULL);
input_free_device(input_dev);
kfree(a3d);
return err;
--
2.45.2
Powered by blists - more mailing lists