From: Frank Praznik <frank.praznik@oh.rr.com>
To: linux-input@vger.kernel.org
Cc: dh.herrmann@gmail.com, jkosina@suse.cz,
Frank Praznik <frank.praznik@oh.rr.com>
Subject: [PATCH 2/3] HID: sony: Force-feedback cleanup
Date: Tue, 18 Feb 2014 17:22:02 -0500 [thread overview]
Message-ID: <1392762123-17725-3-git-send-email-frank.praznik@oh.rr.com> (raw)
In-Reply-To: <1392762123-17725-1-git-send-email-frank.praznik@oh.rr.com>
Only initialize force feedback for devices that actually support it (Sixaxis and
Dualshock 4).
Move the cancel_work_sync() call out of sony_destroy_ff() since the state worker
is used for the LEDs even when force-feedback is disabled.
Remove the sony_destroy_ff() function since it is no longer used.
Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
---
drivers/hid/hid-sony.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 81917eb..ad1cebd 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -50,6 +50,7 @@
#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\
DUALSHOCK4_CONTROLLER)
#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)
+#define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | DUALSHOCK4_CONTROLLER)
#define MAX_LEDS 4
@@ -1354,22 +1355,12 @@ static int sony_init_ff(struct hid_device *hdev)
return input_ff_create_memless(input_dev, NULL, sony_play_effect);
}
-static void sony_destroy_ff(struct hid_device *hdev)
-{
- struct sony_sc *sc = hid_get_drvdata(hdev);
-
- cancel_work_sync(&sc->state_worker);
-}
-
#else
static int sony_init_ff(struct hid_device *hdev)
{
return 0;
}
-static void sony_destroy_ff(struct hid_device *hdev)
-{
-}
#endif
static int sony_battery_get_property(struct power_supply *psy,
@@ -1567,9 +1558,11 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
}
}
- ret = sony_init_ff(hdev);
- if (ret < 0)
- goto err_close;
+ if (sc->quirks & SONY_FF_SUPPORT) {
+ ret = sony_init_ff(hdev);
+ if (ret < 0)
+ goto err_close;
+ }
return 0;
err_close:
@@ -1595,7 +1588,7 @@ static void sony_remove(struct hid_device *hdev)
sony_battery_remove(sc);
}
- sony_destroy_ff(hdev);
+ cancel_work_sync(&sc->state_worker);
hid_hw_stop(hdev);
}
--
1.8.5.3
next prev parent reply other threads:[~2014-02-18 22:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 22:22 [PATCH 0/3] HID: sony: Various cleanups and fixes for the sony module Frank Praznik
2014-02-18 22:22 ` [PATCH 1/3] HID: sony: Enable LED controls and rumble for the Sixaxis on Bluetooth Frank Praznik
2014-02-19 10:18 ` David Herrmann
2014-02-20 13:10 ` Jiri Kosina
2014-02-18 22:22 ` Frank Praznik [this message]
2014-02-19 10:23 ` [PATCH 2/3] HID: sony: Force-feedback cleanup David Herrmann
2014-02-18 22:22 ` [PATCH 3/3] HID: sony: Prevent duplicate controller connections Frank Praznik
2014-02-19 11:04 ` David Herrmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392762123-17725-3-git-send-email-frank.praznik@oh.rr.com \
--to=frank.praznik@oh.rr.com \
--cc=dh.herrmann@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).