···4141 device, hence no steps need to be passed.42424343 rotary-encoder,rollover:4444- $ref: /schemas/types.yaml#/definitions/int324444+ $ref: /schemas/types.yaml#/definitions/flag4545 description:4646 Automatic rollover when the rotary value becomes4747 greater than the specified steps or smaller than 0. For absolute axis only.
···264264 struct timeval time;265265 unsigned short type;266266 unsigned short code;267267- unsigned int value;267267+ int value;268268 };269269270270``time`` is the timestamp, it returns the time at which the event happened.
+1
MAINTAINERS
···1626016260M: Hans de Goede <hdegoede@redhat.com>1626116261L: linux-input@vger.kernel.org1626216262S: Maintained1626316263+F: Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml1626316264F: drivers/input/touchscreen/novatek-nvt-ts.c16264162651626516266NSDEPS
+10-5
drivers/input/input.c
···605605606606 handle->open++;607607608608+ if (handle->handler->passive_observer)609609+ goto out;610610+608611 if (dev->users++ || dev->inhibited) {609612 /*610613 * Device is already opened and/or inhibited,···671668672669 __input_release_device(handle);673670674674- if (!--dev->users && !dev->inhibited) {675675- if (dev->poller)676676- input_dev_poller_stop(dev->poller);677677- if (dev->close)678678- dev->close(dev);671671+ if (!handle->handler->passive_observer) {672672+ if (!--dev->users && !dev->inhibited) {673673+ if (dev->poller)674674+ input_dev_poller_stop(dev->poller);675675+ if (dev->close)676676+ dev->close(dev);677677+ }679678 }680679681680 if (!--handle->open) {
···3131 int c;3232 int empty;3333 int head, tail;3434- unsigned long flags;35343635/*3736 * Update head and tail of xmit buffer3837 */3939- spin_lock_irqsave(&iforce->xmit_lock, flags);3838+ scoped_guard(spinlock_irqsave, &iforce->xmit_lock) {3939+ head = iforce->xmit.head;4040+ tail = iforce->xmit.tail;40414141- head = iforce->xmit.head;4242- tail = iforce->xmit.tail;4242+ if (CIRC_SPACE(head, tail, XMIT_SIZE) < n + 2) {4343+ dev_warn(&iforce->dev->dev,4444+ "not enough space in xmit buffer to send new packet\n");4545+ return -1;4646+ }43474444-4545- if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {4646- dev_warn(&iforce->dev->dev,4747- "not enough space in xmit buffer to send new packet\n");4848- spin_unlock_irqrestore(&iforce->xmit_lock, flags);4949- return -1;5050- }5151-5252- empty = head == tail;5353- XMIT_INC(iforce->xmit.head, n+2);4848+ empty = head == tail;4949+ XMIT_INC(iforce->xmit.head, n + 2);54505551/*5652 * Store packet in xmit buffer5753 */5858- iforce->xmit.buf[head] = HI(cmd);5959- XMIT_INC(head, 1);6060- iforce->xmit.buf[head] = LO(cmd);6161- XMIT_INC(head, 1);5454+ iforce->xmit.buf[head] = HI(cmd);5555+ XMIT_INC(head, 1);5656+ iforce->xmit.buf[head] = LO(cmd);5757+ XMIT_INC(head, 1);62586363- c = CIRC_SPACE_TO_END(head, tail, XMIT_SIZE);6464- if (n < c) c=n;5959+ c = CIRC_SPACE_TO_END(head, tail, XMIT_SIZE);6060+ if (n < c)6161+ c = n;65626666- memcpy(&iforce->xmit.buf[head],6767- data,6868- c);6969- if (n != c) {7070- memcpy(&iforce->xmit.buf[0],7171- data + c,7272- n - c);6363+ memcpy(&iforce->xmit.buf[head], data, c);6464+ if (n != c)6565+ memcpy(&iforce->xmit.buf[0], data + c, n - c);6666+6767+ XMIT_INC(head, n);7368 }7474- XMIT_INC(head, n);75697676- spin_unlock_irqrestore(&iforce->xmit_lock, flags);7770/*7871 * If necessary, start the transmission7972 */
+15-21
drivers/input/joystick/iforce/iforce-serio.c
···2828 iforce);2929 unsigned char cs;3030 int i;3131- unsigned long flags;32313332 if (test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) {3433 set_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags);3534 return;3635 }37363838- spin_lock_irqsave(&iforce->xmit_lock, flags);3737+ guard(spinlock_irqsave)(&iforce->xmit_lock);39384040-again:4141- if (iforce->xmit.head == iforce->xmit.tail) {4242- iforce_clear_xmit_and_wake(iforce);4343- spin_unlock_irqrestore(&iforce->xmit_lock, flags);4444- return;4545- }3939+ do {4040+ if (iforce->xmit.head == iforce->xmit.tail)4141+ break;46424747- cs = 0x2b;4343+ cs = 0x2b;48444949- serio_write(iforce_serio->serio, 0x2b);4545+ serio_write(iforce_serio->serio, 0x2b);50465151- serio_write(iforce_serio->serio, iforce->xmit.buf[iforce->xmit.tail]);5252- cs ^= iforce->xmit.buf[iforce->xmit.tail];5353- XMIT_INC(iforce->xmit.tail, 1);5454-5555- for (i=iforce->xmit.buf[iforce->xmit.tail]; i >= 0; --i) {5647 serio_write(iforce_serio->serio,5748 iforce->xmit.buf[iforce->xmit.tail]);5849 cs ^= iforce->xmit.buf[iforce->xmit.tail];5950 XMIT_INC(iforce->xmit.tail, 1);6060- }61516262- serio_write(iforce_serio->serio, cs);5252+ for (i = iforce->xmit.buf[iforce->xmit.tail]; i >= 0; --i) {5353+ serio_write(iforce_serio->serio,5454+ iforce->xmit.buf[iforce->xmit.tail]);5555+ cs ^= iforce->xmit.buf[iforce->xmit.tail];5656+ XMIT_INC(iforce->xmit.tail, 1);5757+ }63586464- if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags))6565- goto again;5959+ serio_write(iforce_serio->serio, cs);6060+6161+ } while (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags));66626763 iforce_clear_xmit_and_wake(iforce);6868-6969- spin_unlock_irqrestore(&iforce->xmit_lock, flags);7064}71657266static int iforce_serio_get_id(struct iforce *iforce, u8 id,
+6-7
drivers/input/joystick/iforce/iforce-usb.c
···2525 struct iforce_usb *iforce_usb = container_of(iforce, struct iforce_usb,2626 iforce);2727 int n, c;2828- unsigned long flags;29283030- spin_lock_irqsave(&iforce->xmit_lock, flags);2929+ guard(spinlock_irqsave)(&iforce->xmit_lock);31303231 if (iforce->xmit.head == iforce->xmit.tail) {3332 iforce_clear_xmit_and_wake(iforce);3434- spin_unlock_irqrestore(&iforce->xmit_lock, flags);3533 return;3634 }3735···43454446 /* Copy rest of data then */4547 c = CIRC_CNT_TO_END(iforce->xmit.head, iforce->xmit.tail, XMIT_SIZE);4646- if (n < c) c=n;4848+ if (n < c)4949+ c = n;47504851 memcpy(iforce_usb->out->transfer_buffer + 1,4952 &iforce->xmit.buf[iforce->xmit.tail],···5253 if (n != c) {5354 memcpy(iforce_usb->out->transfer_buffer + 1 + c,5455 &iforce->xmit.buf[0],5555- n-c);5656+ n - c);5657 }5758 XMIT_INC(iforce->xmit.tail, n);58595959- if ( (n=usb_submit_urb(iforce_usb->out, GFP_ATOMIC)) ) {6060+ n=usb_submit_urb(iforce_usb->out, GFP_ATOMIC);6161+ if (n) {6062 dev_warn(&iforce_usb->intf->dev,6163 "usb_submit_urb failed %d\n", n);6264 iforce_clear_xmit_and_wake(iforce);···6666 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended.6767 * As long as the urb completion handler is not called, the transmiting6868 * is considered to be running */6969- spin_unlock_irqrestore(&iforce->xmit_lock, flags);7069}71707271static void iforce_usb_xmit(struct iforce *iforce)
+14-17
drivers/input/joystick/n64joy.c
···191191static int n64joy_open(struct input_dev *dev)192192{193193 struct n64joy_priv *priv = input_get_drvdata(dev);194194- int err;195194196196- err = mutex_lock_interruptible(&priv->n64joy_mutex);197197- if (err)198198- return err;195195+ scoped_guard(mutex_intr, &priv->n64joy_mutex) {196196+ if (!priv->n64joy_opened) {197197+ /*198198+ * We could use the vblank irq, but it's not important199199+ * if the poll point slightly changes.200200+ */201201+ timer_setup(&priv->timer, n64joy_poll, 0);202202+ mod_timer(&priv->timer, jiffies + msecs_to_jiffies(16));203203+ }199204200200- if (!priv->n64joy_opened) {201201- /*202202- * We could use the vblank irq, but it's not important if203203- * the poll point slightly changes.204204- */205205- timer_setup(&priv->timer, n64joy_poll, 0);206206- mod_timer(&priv->timer, jiffies + msecs_to_jiffies(16));205205+ priv->n64joy_opened++;206206+ return 0;207207 }208208209209- priv->n64joy_opened++;210210-211211- mutex_unlock(&priv->n64joy_mutex);212212- return err;209209+ return -EINTR;213210}214211215212static void n64joy_close(struct input_dev *dev)216213{217214 struct n64joy_priv *priv = input_get_drvdata(dev);218215219219- mutex_lock(&priv->n64joy_mutex);216216+ guard(mutex)(&priv->n64joy_mutex);217217+220218 if (!--priv->n64joy_opened)221219 del_timer_sync(&priv->timer);222222- mutex_unlock(&priv->n64joy_mutex);223220}224221225222static const u64 __initconst scandata[] ____cacheline_aligned = {
···180180/* send a command to the HIL */181181static void hil_do(unsigned char cmd, unsigned char *data, unsigned int len)182182{183183- unsigned long flags;183183+ guard(spinlock_irqsave)(&hil_dev.lock);184184185185- spin_lock_irqsave(&hil_dev.lock, flags);186185 while (hil_busy())187186 /* wait */;188187 hil_command(cmd);···190191 /* wait */;191192 hil_write_data(*(data++));192193 }193193- spin_unlock_irqrestore(&hil_dev.lock, flags);194194}195195196196
+11-16
drivers/input/keyboard/imx_keypad.c
···521521 struct input_dev *input_dev = kbd->input_dev;522522 unsigned short reg_val = readw(kbd->mmio_base + KPSR);523523524524- /* imx kbd can wake up system even clock is disabled */525525- mutex_lock(&input_dev->mutex);526526-527527- if (input_device_enabled(input_dev))528528- clk_disable_unprepare(kbd->clk);529529-530530- mutex_unlock(&input_dev->mutex);524524+ scoped_guard(mutex, &input_dev->mutex) {525525+ /* imx kbd can wake up system even clock is disabled */526526+ if (input_device_enabled(input_dev))527527+ clk_disable_unprepare(kbd->clk);528528+ }531529532530 if (device_may_wakeup(&pdev->dev)) {533531 if (reg_val & KBD_STAT_KPKD)···545547 struct platform_device *pdev = to_platform_device(dev);546548 struct imx_keypad *kbd = platform_get_drvdata(pdev);547549 struct input_dev *input_dev = kbd->input_dev;548548- int ret = 0;550550+ int error;549551550552 if (device_may_wakeup(&pdev->dev))551553 disable_irq_wake(kbd->irq);552554553553- mutex_lock(&input_dev->mutex);555555+ guard(mutex)(&input_dev->mutex);554556555557 if (input_device_enabled(input_dev)) {556556- ret = clk_prepare_enable(kbd->clk);557557- if (ret)558558- goto err_clk;558558+ error = clk_prepare_enable(kbd->clk);559559+ if (error)560560+ return error;559561 }560562561561-err_clk:562562- mutex_unlock(&input_dev->mutex);563563-564564- return ret;563563+ return 0;565564}566565567566static const struct dev_pm_ops imx_kbd_pm_ops = {
···132132 * We should always get the lock because the only133133 * time it may be locked is if the driver is in the cleanup phase.134134 */135135- if (likely(mutex_trylock(&maple_keyb_mutex))) {136136-135135+ scoped_guard(mutex_try, &maple_keyb_mutex) {137136 if (buf[1] == mapledev->function) {138137 memcpy(kbd->new, buf + 2, 8);139138 dc_scan_kbd(kbd);140139 }141141-142142- mutex_unlock(&maple_keyb_mutex);143140 }144141}145142···208211 struct maple_device *mdev = to_maple_dev(dev);209212 struct dc_kbd *kbd = maple_get_drvdata(mdev);210213211211- mutex_lock(&maple_keyb_mutex);214214+ guard(mutex)(&maple_keyb_mutex);212215213216 input_unregister_device(kbd->dev);214217 kfree(kbd);215218216219 maple_set_drvdata(mdev, NULL);217217-218218- mutex_unlock(&maple_keyb_mutex);219220 return 0;220221}221222
+8-11
drivers/input/keyboard/matrix_keypad.c
···1717#include <linux/jiffies.h>1818#include <linux/module.h>1919#include <linux/gpio.h>2020-#include <linux/gpio/consumer.h>2120#include <linux/input/matrix_keypad.h>2221#include <linux/slab.h>2322#include <linux/of.h>···157158 activate_all_cols(keypad, true);158159159160 /* Enable IRQs again */160160- spin_lock_irq(&keypad->lock);161161- keypad->scan_pending = false;162162- enable_row_irqs(keypad);163163- spin_unlock_irq(&keypad->lock);161161+ scoped_guard(spinlock_irq, &keypad->lock) {162162+ keypad->scan_pending = false;163163+ enable_row_irqs(keypad);164164+ }164165}165166166167static irqreturn_t matrix_keypad_interrupt(int irq, void *id)167168{168169 struct matrix_keypad *keypad = id;169169- unsigned long flags;170170171171- spin_lock_irqsave(&keypad->lock, flags);171171+ guard(spinlock_irqsave)(&keypad->lock);172172173173 /*174174 * See if another IRQ beaten us to it and scheduled the···183185 msecs_to_jiffies(keypad->debounce_ms));184186185187out:186186- spin_unlock_irqrestore(&keypad->lock, flags);187188 return IRQ_HANDLED;188189}189190···206209{207210 struct matrix_keypad *keypad = input_get_drvdata(dev);208211209209- spin_lock_irq(&keypad->lock);210210- keypad->stopped = true;211211- spin_unlock_irq(&keypad->lock);212212+ scoped_guard(spinlock_irq, &keypad->lock) {213213+ keypad->stopped = true;214214+ }212215213216 flush_delayed_work(&keypad->work);214217 /*
+3-42
drivers/input/keyboard/mpr121_touchkey.c
···8282 { AUTO_CONFIG_CTRL_ADDR, 0x0b },8383};84848585-static void mpr121_vdd_supply_disable(void *data)8686-{8787- struct regulator *vdd_supply = data;8888-8989- regulator_disable(vdd_supply);9090-}9191-9292-static struct regulator *mpr121_vdd_supply_init(struct device *dev)9393-{9494- struct regulator *vdd_supply;9595- int err;9696-9797- vdd_supply = devm_regulator_get(dev, "vdd");9898- if (IS_ERR(vdd_supply)) {9999- dev_err(dev, "failed to get vdd regulator: %ld\n",100100- PTR_ERR(vdd_supply));101101- return vdd_supply;102102- }103103-104104- err = regulator_enable(vdd_supply);105105- if (err) {106106- dev_err(dev, "failed to enable vdd regulator: %d\n", err);107107- return ERR_PTR(err);108108- }109109-110110- err = devm_add_action_or_reset(dev, mpr121_vdd_supply_disable,111111- vdd_supply);112112- if (err) {113113- dev_err(dev, "failed to add disable regulator action: %d\n",114114- err);115115- return ERR_PTR(err);116116- }117117-118118- return vdd_supply;119119-}120120-12185static void mpr_touchkey_report(struct input_dev *dev)12286{12387 struct mpr121_touchkey *mpr121 = input_get_drvdata(dev);···197233static int mpr_touchkey_probe(struct i2c_client *client)198234{199235 struct device *dev = &client->dev;200200- struct regulator *vdd_supply;201236 int vdd_uv;202237 struct mpr121_touchkey *mpr121;203238 struct input_dev *input_dev;···204241 int error;205242 int i;206243207207- vdd_supply = mpr121_vdd_supply_init(dev);208208- if (IS_ERR(vdd_supply))209209- return PTR_ERR(vdd_supply);210210-211211- vdd_uv = regulator_get_voltage(vdd_supply);244244+ vdd_uv = devm_regulator_get_enable_read_voltage(dev, "vdd");245245+ if (vdd_uv < 0)246246+ return dev_err_probe(dev, vdd_uv, "failed to get vdd voltage\n");212247213248 mpr121 = devm_kzalloc(dev, sizeof(*mpr121), GFP_KERNEL);214249 if (!mpr121)
···630630 if (device_may_wakeup(dev)) {631631 enable_irq_wake(kp->key_sense_irq);632632 } else {633633- mutex_lock(&input_dev->mutex);633633+ guard(mutex)(&input_dev->mutex);634634635635 if (input_device_enabled(input_dev))636636 pmic8xxx_kp_disable(kp);637637-638638- mutex_unlock(&input_dev->mutex);639637 }640638641639 return 0;···648650 if (device_may_wakeup(dev)) {649651 disable_irq_wake(kp->key_sense_irq);650652 } else {651651- mutex_lock(&input_dev->mutex);653653+ guard(mutex)(&input_dev->mutex);652654653655 if (input_device_enabled(input_dev))654656 pmic8xxx_kp_enable(kp);655655-656656- mutex_unlock(&input_dev->mutex);657657 }658658659659 return 0;
+8-8
drivers/input/keyboard/pxa27x_keypad.c
···682682 struct platform_device *pdev = to_platform_device(dev);683683 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);684684 struct input_dev *input_dev = keypad->input_dev;685685- int ret = 0;685685+ int error;686686687687 /*688688 * If the keypad is used as wake up source, the clock is not turned···691691 if (device_may_wakeup(&pdev->dev)) {692692 disable_irq_wake(keypad->irq);693693 } else {694694- mutex_lock(&input_dev->mutex);694694+ guard(mutex)(&input_dev->mutex);695695696696 if (input_device_enabled(input_dev)) {697697 /* Enable unit clock */698698- ret = clk_prepare_enable(keypad->clk);699699- if (!ret)700700- pxa27x_keypad_config(keypad);701701- }698698+ error = clk_prepare_enable(keypad->clk);699699+ if (error)700700+ return error;702701703703- mutex_unlock(&input_dev->mutex);702702+ pxa27x_keypad_config(keypad);703703+ }704704 }705705706706- return ret;706706+ return 0;707707}708708709709static DEFINE_SIMPLE_DEV_PM_OPS(pxa27x_keypad_pm_ops,
···2323 *2424 * The value is in byte range, however, I only figured out2525 * how bits 0b10011001 work. Some other bits, probably,2626- * are meaningfull too.2626+ * are meaningful too.2727 *2828 * Possible states:2929 *···95959696static u8 slidebar_pos_get(void)9797{9898- u8 res;9999- unsigned long flags;9898+ guard(spinlock_irqsave)(&io_lock);10099101101- spin_lock_irqsave(&io_lock, flags);102100 outb(0xf4, 0xff29);103101 outb(0xbf, 0xff2a);104104- res = inb(0xff2b);105105- spin_unlock_irqrestore(&io_lock, flags);106106-107107- return res;102102+ return inb(0xff2b);108103}109104110105static u8 slidebar_mode_get(void)111106{112112- u8 res;113113- unsigned long flags;107107+ guard(spinlock_irqsave)(&io_lock);114108115115- spin_lock_irqsave(&io_lock, flags);116109 outb(0xf7, 0xff29);117110 outb(0x8b, 0xff2a);118118- res = inb(0xff2b);119119- spin_unlock_irqrestore(&io_lock, flags);120120-121121- return res;111111+ return inb(0xff2b);122112}123113124114static void slidebar_mode_set(u8 mode)125115{126126- unsigned long flags;116116+ guard(spinlock_irqsave)(&io_lock);127117128128- spin_lock_irqsave(&io_lock, flags);129118 outb(0xf7, 0xff29);130119 outb(0x8b, 0xff2a);131120 outb(mode, 0xff2b);132132- spin_unlock_irqrestore(&io_lock, flags);133121}134122135123static bool slidebar_i8042_filter(unsigned char data, unsigned char str,···255267 .driver = {256268 .name = "ideapad_slidebar",257269 },258258- .remove_new = ideapad_remove,270270+ .remove = ideapad_remove,259271};260272261273static int __init ideapad_dmi_check(const struct dmi_system_id *id)
+1-1
drivers/input/misc/ims-pcu.c
···739739{740740 int error;741741742742- /* Execute jump to the bootoloader */742742+ /* Execute jump to the bootloader */743743 error = ims_pcu_execute_command(pcu, JUMP_TO_BTLDR, NULL, 0);744744 if (error) {745745 dev_err(pcu->dev,
···194194static void powermate_config_complete(struct urb *urb)195195{196196 struct powermate_device *pm = urb->context;197197- unsigned long flags;198197199198 if (urb->status)200199 printk(KERN_ERR "powermate: config urb returned %d\n", urb->status);201200202202- spin_lock_irqsave(&pm->lock, flags);201201+ guard(spinlock_irqsave)(&pm->lock);203202 powermate_sync_state(pm);204204- spin_unlock_irqrestore(&pm->lock, flags);205203}206204207205/* Set the LED up as described and begin the sync with the hardware if required */208206static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed,209207 int pulse_table, int pulse_asleep, int pulse_awake)210208{211211- unsigned long flags;212212-213209 if (pulse_speed < 0)214210 pulse_speed = 0;215211 if (pulse_table < 0)···218222 pulse_asleep = !!pulse_asleep;219223 pulse_awake = !!pulse_awake;220224221221-222222- spin_lock_irqsave(&pm->lock, flags);225225+ guard(spinlock_irqsave)(&pm->lock);223226224227 /* mark state updates which are required */225228 if (static_brightness != pm->static_brightness) {···240245 }241246242247 powermate_sync_state(pm);243243-244244- spin_unlock_irqrestore(&pm->lock, flags);245248}246249247250/* Callback from the Input layer when an event arrives from userspace to configure the LED */
+6-6
drivers/input/misc/pwm-beeper.c
···203203 * beeper->suspended, but to ensure that pwm_beeper_event204204 * does not re-submit work once flag is set.205205 */206206- spin_lock_irq(&beeper->input->event_lock);207207- beeper->suspended = true;208208- spin_unlock_irq(&beeper->input->event_lock);206206+ scoped_guard(spinlock_irq, &beeper->input->event_lock) {207207+ beeper->suspended = true;208208+ }209209210210 pwm_beeper_stop(beeper);211211···216216{217217 struct pwm_beeper *beeper = dev_get_drvdata(dev);218218219219- spin_lock_irq(&beeper->input->event_lock);220220- beeper->suspended = false;221221- spin_unlock_irq(&beeper->input->event_lock);219219+ scoped_guard(spinlock_irq, &beeper->input->event_lock) {220220+ beeper->suspended = false;221221+ }222222223223 /* Let worker figure out if we should resume beeping */224224 schedule_work(&beeper->work);
···515515};516516517517/*518518- * Button info for Microsoft Surface 3 (non pro), this is indentical to518518+ * Button info for Microsoft Surface 3 (non pro), this is identical to519519 * the PNP0C40 info except that the home button is active-high.520520 *521521 * The Surface 3 Pro also has a MSHW0028 ACPI device, but that uses a custom···612612613613static struct platform_driver soc_button_driver = {614614 .probe = soc_button_probe,615615- .remove_new = soc_button_remove,615615+ .remove = soc_button_remove,616616 .driver = {617617 .name = KBUILD_MODNAME,618618 .acpi_match_table = ACPI_PTR(soc_button_acpi_match),
···377377 if (len > sizeof(yld->ctl_data->data))378378 len = sizeof(yld->ctl_data->data);379379380380- /* Combine up to <len> consecutive LCD bytes in a singe request380380+ /* Combine up to <len> consecutive LCD bytes in a single request381381 */382382 yld->ctl_data->cmd = CMD_LCD;383383 yld->ctl_data->offset = cpu_to_be16(ix);···614614 return show_line(dev, buf, LCD_LINE3_OFFSET, LCD_LINE4_OFFSET);615615}616616617617-/* Writing to /sys/../lineX will set the coresponding LCD line.617617+/* Writing to /sys/../lineX will set the corresponding LCD line.618618 * - Excess characters are ignored.619619 * - If less characters are written than allowed, the remaining digits are620620 * unchanged.
···254254 struct byd_data *priv = from_timer(priv, t, timer);255255 struct psmouse *psmouse = priv->psmouse;256256257257- serio_pause_rx(psmouse->ps2dev.serio);257257+ guard(serio_pause_rx)(psmouse->ps2dev.serio);258258+258259 priv->touch = false;259260260261 byd_report_input(psmouse);261261-262262- serio_continue_rx(psmouse->ps2dev.serio);263262264263 /*265264 * Move cursor back to center of pad when we lose touch - this
+116-112
drivers/input/mouse/elan_i2c_core.c
···541541542542 dev_dbg(&client->dev, "Starting firmware update....\n");543543544544- disable_irq(client->irq);544544+ guard(disable_irq)(&client->irq);545545+545546 data->in_fw_update = true;546547547548 retval = __elan_update_firmware(data, fw);···556555 }557556558557 data->in_fw_update = false;559559- enable_irq(client->irq);560558561559 return retval;562560}···621621 const char *buf, size_t count)622622{623623 struct elan_tp_data *data = dev_get_drvdata(dev);624624- const struct firmware *fw;625625- char *fw_name;626624 int error;627625 const u8 *fw_signature;628626 static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF};···629631 return -EINVAL;630632631633 /* Look for a firmware with the product id appended. */632632- fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id);634634+ const char *fw_name __free(kfree) =635635+ kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id);633636 if (!fw_name) {634637 dev_err(dev, "failed to allocate memory for firmware name\n");635638 return -ENOMEM;636639 }637640638641 dev_info(dev, "requesting fw '%s'\n", fw_name);642642+ const struct firmware *fw __free(firmware) = NULL;639643 error = request_firmware(&fw, fw_name, dev);640640- kfree(fw_name);641644 if (error) {642645 dev_err(dev, "failed to request firmware: %d\n", error);643646 return error;···650651 dev_err(dev, "signature mismatch (expected %*ph, got %*ph)\n",651652 (int)sizeof(signature), signature,652653 (int)sizeof(signature), fw_signature);653653- error = -EBADF;654654- goto out_release_fw;654654+ return -EBADF;655655 }656656657657- error = mutex_lock_interruptible(&data->sysfs_mutex);658658- if (error)659659- goto out_release_fw;657657+ scoped_cond_guard(mutex_intr, return -EINTR, &data->sysfs_mutex) {658658+ error = elan_update_firmware(data, fw);659659+ if (error)660660+ return error;661661+ }660662661661- error = elan_update_firmware(data, fw);662662-663663- mutex_unlock(&data->sysfs_mutex);664664-665665-out_release_fw:666666- release_firmware(fw);667667- return error ?: count;663663+ return count;668664}669665670670-static ssize_t calibrate_store(struct device *dev,671671- struct device_attribute *attr,672672- const char *buf, size_t count)666666+static int elan_calibrate(struct elan_tp_data *data)673667{674674- struct i2c_client *client = to_i2c_client(dev);675675- struct elan_tp_data *data = i2c_get_clientdata(client);668668+ struct i2c_client *client = data->client;669669+ struct device *dev = &client->dev;676670 int tries = 20;677671 int retval;678672 int error;679673 u8 val[ETP_CALIBRATE_MAX_LEN];680674681681- retval = mutex_lock_interruptible(&data->sysfs_mutex);682682- if (retval)683683- return retval;684684-685685- disable_irq(client->irq);675675+ guard(disable_irq)(&client->irq);686676687677 data->mode |= ETP_ENABLE_CALIBRATE;688678 retval = data->ops->set_mode(client, data->mode);689679 if (retval) {680680+ data->mode &= ~ETP_ENABLE_CALIBRATE;690681 dev_err(dev, "failed to enable calibration mode: %d\n",691682 retval);692692- goto out;683683+ return retval;693684 }694685695686 retval = data->ops->calibrate(client);···717728 if (!retval)718729 retval = error;719730 }720720-out:721721- enable_irq(client->irq);722722- mutex_unlock(&data->sysfs_mutex);723723- return retval ?: count;731731+ return retval;732732+}733733+734734+static ssize_t calibrate_store(struct device *dev,735735+ struct device_attribute *attr,736736+ const char *buf, size_t count)737737+{738738+ struct i2c_client *client = to_i2c_client(dev);739739+ struct elan_tp_data *data = i2c_get_clientdata(client);740740+ int error;741741+742742+ scoped_cond_guard(mutex_intr, return -EINTR, &data->sysfs_mutex) {743743+ error = elan_calibrate(data);744744+ if (error)745745+ return error;746746+ }747747+748748+ return count;724749}725750726751static ssize_t elan_sysfs_read_mode(struct device *dev,···746743 int error;747744 enum tp_mode mode;748745749749- error = mutex_lock_interruptible(&data->sysfs_mutex);750750- if (error)751751- return error;752752-753753- error = data->ops->iap_get_mode(data->client, &mode);754754-755755- mutex_unlock(&data->sysfs_mutex);756756-757757- if (error)758758- return error;746746+ scoped_cond_guard(mutex_intr, return -EINTR, &data->sysfs_mutex) {747747+ error = data->ops->iap_get_mode(data->client, &mode);748748+ if (error)749749+ return error;750750+ }759751760752 return sysfs_emit(buf, "%d\n", (int)mode);761753}···781783 .attrs = elan_sysfs_entries,782784};783785784784-static ssize_t acquire_store(struct device *dev, struct device_attribute *attr,785785- const char *buf, size_t count)786786+static int elan_acquire_baseline(struct elan_tp_data *data)786787{787787- struct i2c_client *client = to_i2c_client(dev);788788- struct elan_tp_data *data = i2c_get_clientdata(client);789789- int error;788788+ struct i2c_client *client = data->client;789789+ struct device *dev = &client->dev;790790 int retval;791791+ int error;791792792792- retval = mutex_lock_interruptible(&data->sysfs_mutex);793793- if (retval)794794- return retval;795795-796796- disable_irq(client->irq);793793+ guard(disable_irq)(&client->irq);797794798795 data->baseline_ready = false;799796800797 data->mode |= ETP_ENABLE_CALIBRATE;801801- retval = data->ops->set_mode(data->client, data->mode);798798+ retval = data->ops->set_mode(client, data->mode);802799 if (retval) {800800+ data->mode &= ~ETP_ENABLE_CALIBRATE;803801 dev_err(dev, "Failed to enable calibration mode to get baseline: %d\n",804802 retval);805805- goto out;803803+ return retval;806804 }807805808806 msleep(250);809807810810- retval = data->ops->get_baseline_data(data->client, true,808808+ retval = data->ops->get_baseline_data(client, true,811809 &data->max_baseline);812810 if (retval) {813813- dev_err(dev, "Failed to read max baseline form device: %d\n",811811+ dev_err(dev, "Failed to read max baseline from device: %d\n",814812 retval);815813 goto out_disable_calibrate;816814 }817815818818- retval = data->ops->get_baseline_data(data->client, false,816816+ retval = data->ops->get_baseline_data(client, false,819817 &data->min_baseline);820818 if (retval) {821821- dev_err(dev, "Failed to read min baseline form device: %d\n",819819+ dev_err(dev, "Failed to read min baseline from device: %d\n",822820 retval);823821 goto out_disable_calibrate;824822 }···823829824830out_disable_calibrate:825831 data->mode &= ~ETP_ENABLE_CALIBRATE;826826- error = data->ops->set_mode(data->client, data->mode);832832+ error = data->ops->set_mode(client, data->mode);827833 if (error) {828834 dev_err(dev, "Failed to disable calibration mode after acquiring baseline: %d\n",829835 error);830836 if (!retval)831837 retval = error;832838 }833833-out:834834- enable_irq(client->irq);835835- mutex_unlock(&data->sysfs_mutex);836836- return retval ?: count;839839+840840+ return retval;841841+}842842+843843+static ssize_t acquire_store(struct device *dev, struct device_attribute *attr,844844+ const char *buf, size_t count)845845+{846846+ struct i2c_client *client = to_i2c_client(dev);847847+ struct elan_tp_data *data = i2c_get_clientdata(client);848848+ int error;849849+850850+ scoped_cond_guard(mutex_intr, return -EINTR, &data->sysfs_mutex) {851851+ error = elan_acquire_baseline(data);852852+ if (error)853853+ return error;854854+ }855855+856856+ return count;837857}838858839859static ssize_t min_show(struct device *dev,···855847{856848 struct i2c_client *client = to_i2c_client(dev);857849 struct elan_tp_data *data = i2c_get_clientdata(client);858858- int retval;859850860860- retval = mutex_lock_interruptible(&data->sysfs_mutex);861861- if (retval)862862- return retval;851851+ scoped_guard(mutex_intr, &data->sysfs_mutex) {852852+ if (!data->baseline_ready)853853+ return -ENODATA;863854864864- if (!data->baseline_ready) {865865- retval = -ENODATA;866866- goto out;855855+ return sysfs_emit(buf, "%d", data->min_baseline);867856 }868857869869- retval = sysfs_emit(buf, "%d", data->min_baseline);870870-871871-out:872872- mutex_unlock(&data->sysfs_mutex);873873- return retval;858858+ return -EINTR;874859}875860876861static ssize_t max_show(struct device *dev,···871870{872871 struct i2c_client *client = to_i2c_client(dev);873872 struct elan_tp_data *data = i2c_get_clientdata(client);874874- int retval;875873876876- retval = mutex_lock_interruptible(&data->sysfs_mutex);877877- if (retval)878878- return retval;874874+ scoped_guard(mutex_intr, &data->sysfs_mutex) {875875+ if (!data->baseline_ready)876876+ return -ENODATA;879877880880- if (!data->baseline_ready) {881881- retval = -ENODATA;882882- goto out;878878+ return sysfs_emit(buf, "%d", data->max_baseline);883879 }884880885885- retval = sysfs_emit(buf, "%d", data->max_baseline);886886-887887-out:888888- mutex_unlock(&data->sysfs_mutex);889889- return retval;881881+ return -EINTR;890882}891891-892883893884static DEVICE_ATTR_WO(acquire);894885static DEVICE_ATTR_RO(min);···13161323 return 0;13171324}1318132513261326+static int __elan_suspend(struct elan_tp_data *data)13271327+{13281328+ struct i2c_client *client = data->client;13291329+ int error;13301330+13311331+ if (device_may_wakeup(&client->dev))13321332+ return elan_sleep(data);13331333+13341334+ /* Touchpad is not a wakeup source */13351335+ error = elan_set_power(data, false);13361336+ if (error)13371337+ return error;13381338+13391339+ error = regulator_disable(data->vcc);13401340+ if (error) {13411341+ dev_err(&client->dev,13421342+ "failed to disable regulator when suspending: %d\n",13431343+ error);13441344+ /* Attempt to power the chip back up */13451345+ elan_set_power(data, true);13461346+ return error;13471347+ }13481348+13491349+ return 0;13501350+}13511351+13191352static int elan_suspend(struct device *dev)13201353{13211354 struct i2c_client *client = to_i2c_client(dev);13221355 struct elan_tp_data *data = i2c_get_clientdata(client);13231323- int ret;13561356+ int error;1324135713251358 /*13261359 * We are taking the mutex to make sure sysfs operations are13271360 * complete before we attempt to bring the device into low[er]13281361 * power mode.13291362 */13301330- ret = mutex_lock_interruptible(&data->sysfs_mutex);13311331- if (ret)13321332- return ret;13631363+ scoped_cond_guard(mutex_intr, return -EINTR, &data->sysfs_mutex) {13641364+ disable_irq(client->irq);1333136513341334- disable_irq(client->irq);13351335-13361336- if (device_may_wakeup(dev)) {13371337- ret = elan_sleep(data);13381338- } else {13391339- ret = elan_set_power(data, false);13401340- if (ret)13411341- goto err;13421342-13431343- ret = regulator_disable(data->vcc);13441344- if (ret) {13451345- dev_err(dev, "error %d disabling regulator\n", ret);13461346- /* Attempt to power the chip back up */13471347- elan_set_power(data, true);13661366+ error = __elan_suspend(data);13671367+ if (error) {13681368+ enable_irq(client->irq);13691369+ return error;13481370 }13491371 }1350137213511351-err:13521352- if (ret)13531353- enable_irq(client->irq);13541354- mutex_unlock(&data->sysfs_mutex);13551355- return ret;13731373+ return 0;13561374}1357137513581376static int elan_resume(struct device *dev)
+5-9
drivers/input/mouse/elan_i2c_i2c.c
···628628 const u8 *page, u16 checksum, int idx)629629{630630 struct device *dev = &client->dev;631631- u8 *page_store;632631 u8 val[3];633632 u16 result;634633 int ret, error;635634636636- page_store = kmalloc(fw_page_size + 4, GFP_KERNEL);635635+ u8 *page_store __free(kfree) = kmalloc(fw_page_size + 4, GFP_KERNEL);637636 if (!page_store)638637 return -ENOMEM;639638···646647 if (ret != fw_page_size + 4) {647648 error = ret < 0 ? ret : -EIO;648649 dev_err(dev, "Failed to write page %d: %d\n", idx, error);649649- goto exit;650650+ return error;650651 }651652652653 /* Wait for F/W to update one page ROM data. */···655656 error = elan_i2c_read_cmd(client, ETP_I2C_IAP_CTRL_CMD, val);656657 if (error) {657658 dev_err(dev, "Failed to read IAP write result: %d\n", error);658658- goto exit;659659+ return error;659660 }660661661662 result = le16_to_cpup((__le16 *)val);662663 if (result & (ETP_FW_IAP_PAGE_ERR | ETP_FW_IAP_INTF_ERR)) {663664 dev_err(dev, "IAP reports failed write: %04hx\n",664665 result);665665- error = -EIO;666666- goto exit;666666+ return -EIO;667667 }668668669669-exit:670670- kfree(page_store);671671- return error;669669+ return 0;672670}673671674672static int elan_i2c_finish_fw_update(struct i2c_client *client,
···145145146146static inline int gscps2_writeb_output(struct gscps2port *ps2port, u8 data)147147{148148- unsigned long flags;149148 char __iomem *addr = ps2port->addr;150149151150 if (!wait_TBE(addr)) {···155156 while (gscps2_readb_status(addr) & GSC_STAT_RBNE)156157 /* wait */;157158158158- spin_lock_irqsave(&ps2port->lock, flags);159159- writeb(data, addr+GSC_XMTDATA);160160- spin_unlock_irqrestore(&ps2port->lock, flags);159159+ scoped_guard(spinlock_irqsave, &ps2port->lock)160160+ writeb(data, addr+GSC_XMTDATA);161161162162 /* this is ugly, but due to timing of the port it seems to be necessary. */163163 mdelay(6);···175177176178static void gscps2_enable(struct gscps2port *ps2port, int enable)177179{178178- unsigned long flags;179180 u8 data;180181181182 /* now enable/disable the port */182182- spin_lock_irqsave(&ps2port->lock, flags);183183- gscps2_flush(ps2port);184184- data = gscps2_readb_control(ps2port->addr);185185- if (enable)186186- data |= GSC_CTRL_ENBL;187187- else188188- data &= ~GSC_CTRL_ENBL;189189- gscps2_writeb_control(data, ps2port->addr);190190- spin_unlock_irqrestore(&ps2port->lock, flags);183183+ scoped_guard(spinlock_irqsave, &ps2port->lock) {184184+ gscps2_flush(ps2port);185185+ data = gscps2_readb_control(ps2port->addr);186186+ if (enable)187187+ data |= GSC_CTRL_ENBL;188188+ else189189+ data &= ~GSC_CTRL_ENBL;190190+ gscps2_writeb_control(data, ps2port->addr);191191+ }192192+191193 wait_TBE(ps2port->addr);192194 gscps2_flush(ps2port);193195}···198200199201static void gscps2_reset(struct gscps2port *ps2port)200202{201201- unsigned long flags;202202-203203 /* reset the interface */204204- spin_lock_irqsave(&ps2port->lock, flags);204204+ guard(spinlock_irqsave)(&ps2port->lock);205205 gscps2_flush(ps2port);206206 writeb(0xff, ps2port->addr + GSC_RESET);207207 gscps2_flush(ps2port);208208- spin_unlock_irqrestore(&ps2port->lock, flags);209208}210209211210static LIST_HEAD(ps2port_list);211211+212212+static void gscps2_read_data(struct gscps2port *ps2port)213213+{214214+ u8 status;215215+216216+ do {217217+ status = gscps2_readb_status(ps2port->addr);218218+ if (!(status & GSC_STAT_RBNE))219219+ break;220220+221221+ ps2port->buffer[ps2port->append].str = status;222222+ ps2port->buffer[ps2port->append].data =223223+ gscps2_readb_input(ps2port->addr);224224+ } while (true);225225+}226226+227227+static bool gscps2_report_data(struct gscps2port *ps2port)228228+{229229+ unsigned int rxflags;230230+ u8 data, status;231231+232232+ while (ps2port->act != ps2port->append) {233233+ /*234234+ * Did new data arrived while we read existing data ?235235+ * If yes, exit now and let the new irq handler start236236+ * over again.237237+ */238238+ if (gscps2_readb_status(ps2port->addr) & GSC_STAT_CMPINTR)239239+ return true;240240+241241+ status = ps2port->buffer[ps2port->act].str;242242+ data = ps2port->buffer[ps2port->act].data;243243+244244+ ps2port->act = (ps2port->act + 1) & BUFFER_SIZE;245245+ rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0 ) |246246+ ((status & GSC_STAT_PERR) ? SERIO_PARITY : 0 );247247+248248+ serio_interrupt(ps2port->port, data, rxflags);249249+ }250250+251251+ return false;252252+}212253213254/**214255 * gscps2_interrupt() - Interruption service routine···266229 struct gscps2port *ps2port;267230268231 list_for_each_entry(ps2port, &ps2port_list, node) {232232+ guard(spinlock_irqsave)(&ps2port->lock);269233270270- unsigned long flags;271271- spin_lock_irqsave(&ps2port->lock, flags);272272-273273- while ( (ps2port->buffer[ps2port->append].str =274274- gscps2_readb_status(ps2port->addr)) & GSC_STAT_RBNE ) {275275- ps2port->buffer[ps2port->append].data =276276- gscps2_readb_input(ps2port->addr);277277- ps2port->append = ((ps2port->append+1) & BUFFER_SIZE);278278- }279279-280280- spin_unlock_irqrestore(&ps2port->lock, flags);281281-234234+ gscps2_read_data(ps2port);282235 } /* list_for_each_entry */283236284237 /* all data was read from the ports - now report the data to upper layer */285285-286238 list_for_each_entry(ps2port, &ps2port_list, node) {287287-288288- while (ps2port->act != ps2port->append) {289289-290290- unsigned int rxflags;291291- u8 data, status;292292-293293- /* Did new data arrived while we read existing data ?294294- If yes, exit now and let the new irq handler start over again */295295- if (gscps2_readb_status(ps2port->addr) & GSC_STAT_CMPINTR)296296- return IRQ_HANDLED;297297-298298- status = ps2port->buffer[ps2port->act].str;299299- data = ps2port->buffer[ps2port->act].data;300300-301301- ps2port->act = ((ps2port->act+1) & BUFFER_SIZE);302302- rxflags = ((status & GSC_STAT_TERR) ? SERIO_TIMEOUT : 0 ) |303303- ((status & GSC_STAT_PERR) ? SERIO_PARITY : 0 );304304-305305- serio_interrupt(ps2port->port, data, rxflags);306306-307307- } /* while() */308308-309309- } /* list_for_each_entry */239239+ if (gscps2_report_data(ps2port)) {240240+ /* More data ready - break early to restart interrupt */241241+ break;242242+ }243243+ }310244311245 return IRQ_HANDLED;312246}
+18-20
drivers/input/serio/hyperv-keyboard.c
···102102{103103 struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);104104 struct synth_kbd_keystroke *ks_msg;105105- unsigned long flags;106105 u32 msg_type = __le32_to_cpu(msg->header.type);107106 u32 info;108107 u16 scan_code;···146147 /*147148 * Inject the information through the serio interrupt.148149 */149149- spin_lock_irqsave(&kbd_dev->lock, flags);150150- if (kbd_dev->started) {151151- if (info & IS_E0)152152- serio_interrupt(kbd_dev->hv_serio,153153- XTKBD_EMUL0, 0);154154- if (info & IS_E1)155155- serio_interrupt(kbd_dev->hv_serio,156156- XTKBD_EMUL1, 0);157157- scan_code = __le16_to_cpu(ks_msg->make_code);158158- if (info & IS_BREAK)159159- scan_code |= XTKBD_RELEASE;150150+ scoped_guard(spinlock_irqsave, &kbd_dev->lock) {151151+ if (kbd_dev->started) {152152+ if (info & IS_E0)153153+ serio_interrupt(kbd_dev->hv_serio,154154+ XTKBD_EMUL0, 0);155155+ if (info & IS_E1)156156+ serio_interrupt(kbd_dev->hv_serio,157157+ XTKBD_EMUL1, 0);158158+ scan_code = __le16_to_cpu(ks_msg->make_code);159159+ if (info & IS_BREAK)160160+ scan_code |= XTKBD_RELEASE;160161161161- serio_interrupt(kbd_dev->hv_serio, scan_code, 0);162162+ serio_interrupt(kbd_dev->hv_serio,163163+ scan_code, 0);164164+ }162165 }163163- spin_unlock_irqrestore(&kbd_dev->lock, flags);164166165167 /*166168 * Only trigger a wakeup on key down, otherwise···292292static int hv_kbd_start(struct serio *serio)293293{294294 struct hv_kbd_dev *kbd_dev = serio->port_data;295295- unsigned long flags;296295297297- spin_lock_irqsave(&kbd_dev->lock, flags);296296+ guard(spinlock_irqsave)(&kbd_dev->lock);297297+298298 kbd_dev->started = true;299299- spin_unlock_irqrestore(&kbd_dev->lock, flags);300299301300 return 0;302301}···303304static void hv_kbd_stop(struct serio *serio)304305{305306 struct hv_kbd_dev *kbd_dev = serio->port_data;306306- unsigned long flags;307307308308- spin_lock_irqsave(&kbd_dev->lock, flags);308308+ guard(spinlock_irqsave)(&kbd_dev->lock);309309+309310 kbd_dev->started = false;310310- spin_unlock_irqrestore(&kbd_dev->lock, flags);311311}312312313313static int hv_kbd_probe(struct hv_device *hv_dev,
+1-1
drivers/input/serio/i8042-acpipnpio.h
···9090 * ORDERING IS IMPORTANT! The first match will be apllied and the rest ignored.9191 * This allows entries to overwrite vendor wide quirks on a per device basis.9292 * Where this is irrelevant, entries are sorted case sensitive by DMI_SYS_VENDOR9393- * and/or DMI_BOARD_VENDOR to make it easier to avoid dublicate entries.9393+ * and/or DMI_BOARD_VENDOR to make it easier to avoid duplicate entries.9494 */9595static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {9696 {
···117117 struct pm860x_chip *chip,118118 int *res_x)119119{120120- struct device_node *np = pdev->dev.parent->of_node;121120 struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \122121 : chip->companion;123122 int data, n, ret;124124- if (!np)123123+ if (!pdev->dev.parent->of_node)125124 return -ENODEV;126126- np = of_get_child_by_name(np, "touch");125125+126126+ struct device_node *np __free(device_node) =127127+ of_get_child_by_name(pdev->dev.parent->of_node, "touch");127128 if (!np) {128129 dev_err(&pdev->dev, "Can't find touch node\n");129130 return -EINVAL;···142141 if (data) {143142 ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data);144143 if (ret < 0)145145- goto err_put_node;144144+ return -EINVAL;146145 }147146 /* set tsi prebias time */148147 if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) {149148 ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data);150149 if (ret < 0)151151- goto err_put_node;150150+ return -EINVAL;152151 }153152 /* set prebias & prechg time of pen detect */154153 data = 0;···159158 if (data) {160159 ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data);161160 if (ret < 0)162162- goto err_put_node;161161+ return -EINVAL;163162 }164163 of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x);165164166166- of_node_put(np);167167-168165 return 0;169169-170170-err_put_node:171171- of_node_put(np);172172-173173- return -EINVAL;174166}175167#else176168#define pm860x_touch_dt_init(x, y, z) (-1)
+2
drivers/input/touchscreen/Kconfig
···420420config TOUCHSCREEN_HIDEEP421421 tristate "HiDeep Touch IC"422422 depends on I2C423423+ select REGMAP_I2C423424 help424425 Say Y here if you have a touchscreen using HiDeep.425426···432431config TOUCHSCREEN_HYCON_HY46XX433432 tristate "Hycon hy46xx touchscreen support"434433 depends on I2C434434+ select REGMAP_I2C435435 help436436 Say Y here if you have a touchscreen using Hycon hy46xx437437
+12-2
drivers/input/touchscreen/ads7846.c
···331331 u8 ref_off;332332 u16 scratch;333333 struct spi_message msg;334334- struct spi_transfer xfer[6];334334+ struct spi_transfer xfer[8];335335 /*336336 * DMA (thus cache coherency maintenance) requires the337337 * transfer buffers to live in their own cache lines.···405405406406 req->xfer[5].rx_buf = &req->scratch;407407 req->xfer[5].len = 2;408408- CS_CHANGE(req->xfer[5]);409408 spi_message_add_tail(&req->xfer[5], &req->msg);409409+410410+ /* clear the command register */411411+ req->scratch = 0;412412+ req->xfer[6].tx_buf = &req->scratch;413413+ req->xfer[6].len = 1;414414+ spi_message_add_tail(&req->xfer[6], &req->msg);415415+416416+ req->xfer[7].rx_buf = &req->scratch;417417+ req->xfer[7].len = 2;418418+ CS_CHANGE(req->xfer[7]);419419+ spi_message_add_tail(&req->xfer[7], &req->msg);410420411421 mutex_lock(&ts->lock);412422 ads7846_stop(ts);
+1-1
drivers/input/touchscreen/auo-pixcir-ts.c
···72727373/*7474 * Interrupt modes:7575- * periodical: interrupt is asserted periodicaly7575+ * periodical: interrupt is asserted periodically7676 * compare coordinates: interrupt is asserted when coordinates change7777 * indicate touch: interrupt is asserted during touch7878 */
+1-1
drivers/input/touchscreen/bcm_iproc_tsc.c
···217217 "pen up-down (%d)\n", priv->pen_status);218218 }219219220220- /* coordinates in FIFO exceed the theshold */220220+ /* coordinates in FIFO exceed the threshold */221221 if (intr_status & TS_FIFO_INTR_MASK) {222222 for (i = 0; i < priv->cfg_params.fifo_threshold; i++) {223223 regmap_read(priv->regmap, FIFO_DATA, &raw_coordinate);
···12371237 }1238123812391239 /*12401240- * Check which sleep modes we can support. Power-off requieres the12401240+ * Check which sleep modes we can support. Power-off requires the12411241 * reset-pin to ensure correct power-down/power-up behaviour. Start with12421242 * the EDT_PMODE_POWEROFF test since this is the deepest possible sleep12431243 * mode.
···898898 if (attr == &dev_attr_calibrate.attr)899899 return priv->chip->has_calibrate_reg ? attr->mode : 0;900900901901- /* Firmware/Kernel/Protocol/BootMode is implememted only for ILI251x */901901+ /* Firmware/Kernel/Protocol/BootMode is implemented only for ILI251x */902902 if (!priv->chip->has_firmware_proto)903903 return 0;904904
···388388 err_y = (int)READ_CALIB_BUF(PRM1_Y_H) << 2 |389389 READ_CALIB_BUF(PRM1_Y_L);390390391391- /* X axis ajust */391391+ /* X axis adjust */392392 if (err_x <= 4)393393 calib_x -= AXIS_ADJUST;394394 else if (err_x >= 60)395395 calib_x += AXIS_ADJUST;396396397397- /* Y axis ajust */397397+ /* Y axis adjust */398398 if (err_y <= 4)399399 calib_y -= AXIS_ADJUST;400400 else if (err_y >= 60)
+3-3
drivers/input/touchscreen/stmpe-ts.c
···107107108108 /*109109 * touch_det sometimes get desasserted or just get stuck. This appears110110- * to be a silicon bug, We still have to clearify this with the110110+ * to be a silicon bug, We still have to clarify this with the111111 * manufacture. As a workaround We release the key anyway if the112112 * touch_det keeps coming in after 4ms, while the FIFO contains no value113113 * during the whole time.···140140141141 /*142142 * The FIFO sometimes just crashes and stops generating interrupts. This143143- * appears to be a silicon bug. We still have to clearify this with143143+ * appears to be a silicon bug. We still have to clarify this with144144 * the manufacture. As a workaround we disable the TSC while we are145145 * collecting data and flush the FIFO after reading146146 */···362362 .name = STMPE_TS_NAME,363363 },364364 .probe = stmpe_input_probe,365365- .remove_new = stmpe_ts_remove,365365+ .remove = stmpe_ts_remove,366366};367367module_platform_driver(stmpe_ts_driver);368368
···222222223223/*224224 * Codec GPIO pin configuration, this sets pin direction, polarity,225225- * stickyness and wake up.225225+ * stickiness and wake up.226226 */227227void wm97xx_config_gpio(struct wm97xx *wm, u32 gpio, enum wm97xx_gpio_dir dir,228228 enum wm97xx_gpio_pol pol, enum wm97xx_gpio_sticky sticky,···403403 * is actively working with the touchscreen we404404 * don't want to lose the quick response. So we405405 * will slowly increase sleep time after the406406- * pen is up and quicky restore it to ~one task406406+ * pen is up and quickly restore it to ~one task407407 * switch when pen is down again.408408 */409409 if (wm->ts_reader_interval < HZ / 10)···876876 .pm = pm_sleep_ptr(&wm97xx_pm_ops),877877 },878878 .probe = wm97xx_mfd_probe,879879- .remove_new = wm97xx_mfd_remove,879879+ .remove = wm97xx_mfd_remove,880880};881881882882static int __init wm97xx_init(void)
···286286 * @start: starts handler for given handle. This function is called by287287 * input core right after connect() method and also when a process288288 * that "grabbed" a device releases it289289+ * @passive_observer: set to %true by drivers only interested in observing290290+ * data stream from devices if there are other users present. Such291291+ * drivers will not result in starting underlying hardware device292292+ * when input_open_device() is called for their handles289293 * @legacy_minors: set to %true by drivers using legacy minor ranges290294 * @minor: beginning of range of 32 legacy minors for devices this driver291295 * can provide···325321 void (*disconnect)(struct input_handle *handle);326322 void (*start)(struct input_handle *handle);327323324324+ bool passive_observer;328325 bool legacy_minors;329326 int minor;330327 const char *name;