Skip to content

Commit 8c9089e

Browse files
author
Jiri Kosina
committed
Merge branch 'for-6.9/unused-struct-removal' into for-linus
- removal of unused data structures all over the place (Jiri Slaby)
2 parents 58cd69c + 16d0e1d commit 8c9089e

File tree

6 files changed

+42
-84
lines changed

6 files changed

+42
-84
lines changed

drivers/hid/hid-apple.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ struct apple_non_apple_keyboard {
7979
struct apple_sc_backlight {
8080
struct led_classdev cdev;
8181
struct hid_device *hdev;
82-
unsigned short backlight_off, backlight_on_min, backlight_on_max;
8382
};
8483

8584
struct apple_sc {

drivers/hid/hid-lg3ff.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
* I'm sure these are effects that I don't know enough about them
4242
*/
4343

44-
struct lg3ff_device {
45-
struct hid_report *report;
46-
};
47-
4844
static int hid_lg3ff_play(struct input_dev *dev, void *data,
4945
struct ff_effect *effect)
5046
{

drivers/hid/hid-multitouch.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ struct mt_application {
130130
* > 1 means hybrid (multitouch) protocol
131131
*/
132132

133-
__s32 dev_time; /* the scan time provided by the device */
134133
unsigned long jiffies; /* the frame's jiffies */
135134
int timestamp; /* the timestamp to be sent */
136135
int prev_scantime; /* scantime reported previously */

drivers/hid/hid-prodikeys.c

Lines changed: 40 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@
3232

3333
struct pcmidi_snd;
3434

35-
struct pk_device {
36-
unsigned long quirks;
37-
38-
struct hid_device *hdev;
39-
struct pcmidi_snd *pm; /* pcmidi device context */
40-
};
41-
4235
struct pcmidi_sustain {
4336
unsigned long in_use;
4437
struct pcmidi_snd *pm;
@@ -50,7 +43,7 @@ struct pcmidi_sustain {
5043

5144
#define PCMIDI_SUSTAINED_MAX 32
5245
struct pcmidi_snd {
53-
struct pk_device *pk;
46+
struct hid_device *hdev;
5447
unsigned short ifnum;
5548
struct hid_report *pcmidi_report6;
5649
struct input_dev *input_ep82;
@@ -66,9 +59,7 @@ struct pcmidi_snd {
6659
struct snd_card *card;
6760
struct snd_rawmidi *rwmidi;
6861
struct snd_rawmidi_substream *in_substream;
69-
struct snd_rawmidi_substream *out_substream;
7062
unsigned long in_triggered;
71-
unsigned long out_active;
7263
};
7364

7465
#define PK_QUIRK_NOGET 0x00010000
@@ -100,11 +91,11 @@ static ssize_t show_channel(struct device *dev,
10091
struct device_attribute *attr, char *buf)
10192
{
10293
struct hid_device *hdev = to_hid_device(dev);
103-
struct pk_device *pk = hid_get_drvdata(hdev);
94+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
10495

105-
dbg_hid("pcmidi sysfs read channel=%u\n", pk->pm->midi_channel);
96+
dbg_hid("pcmidi sysfs read channel=%u\n", pm->midi_channel);
10697

107-
return sprintf(buf, "%u (min:%u, max:%u)\n", pk->pm->midi_channel,
98+
return sprintf(buf, "%u (min:%u, max:%u)\n", pm->midi_channel,
10899
PCMIDI_CHANNEL_MIN, PCMIDI_CHANNEL_MAX);
109100
}
110101

@@ -113,13 +104,13 @@ static ssize_t store_channel(struct device *dev,
113104
struct device_attribute *attr, const char *buf, size_t count)
114105
{
115106
struct hid_device *hdev = to_hid_device(dev);
116-
struct pk_device *pk = hid_get_drvdata(hdev);
107+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
117108

118109
unsigned channel = 0;
119110

120111
if (sscanf(buf, "%u", &channel) > 0 && channel <= PCMIDI_CHANNEL_MAX) {
121112
dbg_hid("pcmidi sysfs write channel=%u\n", channel);
122-
pk->pm->midi_channel = channel;
113+
pm->midi_channel = channel;
123114
return strlen(buf);
124115
}
125116
return -EINVAL;
@@ -137,11 +128,11 @@ static ssize_t show_sustain(struct device *dev,
137128
struct device_attribute *attr, char *buf)
138129
{
139130
struct hid_device *hdev = to_hid_device(dev);
140-
struct pk_device *pk = hid_get_drvdata(hdev);
131+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
141132

142-
dbg_hid("pcmidi sysfs read sustain=%u\n", pk->pm->midi_sustain);
133+
dbg_hid("pcmidi sysfs read sustain=%u\n", pm->midi_sustain);
143134

144-
return sprintf(buf, "%u (off:%u, max:%u (ms))\n", pk->pm->midi_sustain,
135+
return sprintf(buf, "%u (off:%u, max:%u (ms))\n", pm->midi_sustain,
145136
PCMIDI_SUSTAIN_MIN, PCMIDI_SUSTAIN_MAX);
146137
}
147138

@@ -150,15 +141,14 @@ static ssize_t store_sustain(struct device *dev,
150141
struct device_attribute *attr, const char *buf, size_t count)
151142
{
152143
struct hid_device *hdev = to_hid_device(dev);
153-
struct pk_device *pk = hid_get_drvdata(hdev);
144+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
154145

155146
unsigned sustain = 0;
156147

157148
if (sscanf(buf, "%u", &sustain) > 0 && sustain <= PCMIDI_SUSTAIN_MAX) {
158149
dbg_hid("pcmidi sysfs write sustain=%u\n", sustain);
159-
pk->pm->midi_sustain = sustain;
160-
pk->pm->midi_sustain_mode =
161-
(0 == sustain || !pk->pm->midi_mode) ? 0 : 1;
150+
pm->midi_sustain = sustain;
151+
pm->midi_sustain_mode = (0 == sustain || !pm->midi_mode) ? 0 : 1;
162152
return strlen(buf);
163153
}
164154
return -EINVAL;
@@ -176,11 +166,11 @@ static ssize_t show_octave(struct device *dev,
176166
struct device_attribute *attr, char *buf)
177167
{
178168
struct hid_device *hdev = to_hid_device(dev);
179-
struct pk_device *pk = hid_get_drvdata(hdev);
169+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
180170

181-
dbg_hid("pcmidi sysfs read octave=%d\n", pk->pm->midi_octave);
171+
dbg_hid("pcmidi sysfs read octave=%d\n", pm->midi_octave);
182172

183-
return sprintf(buf, "%d (min:%d, max:%d)\n", pk->pm->midi_octave,
173+
return sprintf(buf, "%d (min:%d, max:%d)\n", pm->midi_octave,
184174
PCMIDI_OCTAVE_MIN, PCMIDI_OCTAVE_MAX);
185175
}
186176

@@ -189,14 +179,14 @@ static ssize_t store_octave(struct device *dev,
189179
struct device_attribute *attr, const char *buf, size_t count)
190180
{
191181
struct hid_device *hdev = to_hid_device(dev);
192-
struct pk_device *pk = hid_get_drvdata(hdev);
182+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
193183

194184
int octave = 0;
195185

196186
if (sscanf(buf, "%d", &octave) > 0 &&
197187
octave >= PCMIDI_OCTAVE_MIN && octave <= PCMIDI_OCTAVE_MAX) {
198188
dbg_hid("pcmidi sysfs write octave=%d\n", octave);
199-
pk->pm->midi_octave = octave;
189+
pm->midi_octave = octave;
200190
return strlen(buf);
201191
}
202192
return -EINVAL;
@@ -270,7 +260,7 @@ static void stop_sustain_timers(struct pcmidi_snd *pm)
270260

271261
static int pcmidi_get_output_report(struct pcmidi_snd *pm)
272262
{
273-
struct hid_device *hdev = pm->pk->hdev;
263+
struct hid_device *hdev = pm->hdev;
274264
struct hid_report *report;
275265

276266
list_for_each_entry(report,
@@ -295,7 +285,7 @@ static int pcmidi_get_output_report(struct pcmidi_snd *pm)
295285

296286
static void pcmidi_submit_output_report(struct pcmidi_snd *pm, int state)
297287
{
298-
struct hid_device *hdev = pm->pk->hdev;
288+
struct hid_device *hdev = pm->hdev;
299289
struct hid_report *report = pm->pcmidi_report6;
300290
report->field[0]->value[0] = 0x01;
301291
report->field[0]->value[1] = state;
@@ -622,7 +612,7 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
622612

623613
/* Setup sound card */
624614

625-
err = snd_card_new(&pm->pk->hdev->dev, index[dev], id[dev],
615+
err = snd_card_new(&pm->hdev->dev, index[dev], id[dev],
626616
THIS_MODULE, 0, &card);
627617
if (err < 0) {
628618
pk_error("failed to create pc-midi sound card\n");
@@ -660,23 +650,23 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
660650
&pcmidi_in_ops);
661651

662652
/* create sysfs variables */
663-
err = device_create_file(&pm->pk->hdev->dev,
653+
err = device_create_file(&pm->hdev->dev,
664654
sysfs_device_attr_channel);
665655
if (err < 0) {
666656
pk_error("failed to create sysfs attribute channel: error %d\n",
667657
err);
668658
goto fail;
669659
}
670660

671-
err = device_create_file(&pm->pk->hdev->dev,
661+
err = device_create_file(&pm->hdev->dev,
672662
sysfs_device_attr_sustain);
673663
if (err < 0) {
674664
pk_error("failed to create sysfs attribute sustain: error %d\n",
675665
err);
676666
goto fail_attr_sustain;
677667
}
678668

679-
err = device_create_file(&pm->pk->hdev->dev,
669+
err = device_create_file(&pm->hdev->dev,
680670
sysfs_device_attr_octave);
681671
if (err < 0) {
682672
pk_error("failed to create sysfs attribute octave: error %d\n",
@@ -706,11 +696,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
706696

707697
fail_register:
708698
stop_sustain_timers(pm);
709-
device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_octave);
699+
device_remove_file(&pm->hdev->dev, sysfs_device_attr_octave);
710700
fail_attr_octave:
711-
device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_sustain);
701+
device_remove_file(&pm->hdev->dev, sysfs_device_attr_sustain);
712702
fail_attr_sustain:
713-
device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_channel);
703+
device_remove_file(&pm->hdev->dev, sysfs_device_attr_channel);
714704
fail:
715705
if (pm->card) {
716706
snd_card_free(pm->card);
@@ -724,12 +714,9 @@ static int pcmidi_snd_terminate(struct pcmidi_snd *pm)
724714
if (pm->card) {
725715
stop_sustain_timers(pm);
726716

727-
device_remove_file(&pm->pk->hdev->dev,
728-
sysfs_device_attr_channel);
729-
device_remove_file(&pm->pk->hdev->dev,
730-
sysfs_device_attr_sustain);
731-
device_remove_file(&pm->pk->hdev->dev,
732-
sysfs_device_attr_octave);
717+
device_remove_file(&pm->hdev->dev, sysfs_device_attr_channel);
718+
device_remove_file(&pm->hdev->dev, sysfs_device_attr_sustain);
719+
device_remove_file(&pm->hdev->dev, sysfs_device_attr_octave);
733720

734721
snd_card_disconnect(pm->card);
735722
snd_card_free_when_closed(pm->card);
@@ -759,10 +746,7 @@ static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi,
759746
struct hid_field *field, struct hid_usage *usage,
760747
unsigned long **bit, int *max)
761748
{
762-
struct pk_device *pk = hid_get_drvdata(hdev);
763-
struct pcmidi_snd *pm;
764-
765-
pm = pk->pm;
749+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
766750

767751
if (HID_UP_MSVENDOR == (usage->hid & HID_USAGE_PAGE) &&
768752
1 == pm->ifnum) {
@@ -777,16 +761,16 @@ static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi,
777761
static int pk_raw_event(struct hid_device *hdev, struct hid_report *report,
778762
u8 *data, int size)
779763
{
780-
struct pk_device *pk = hid_get_drvdata(hdev);
764+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
781765
int ret = 0;
782766

783-
if (1 == pk->pm->ifnum) {
767+
if (1 == pm->ifnum) {
784768
if (report->id == data[0])
785769
switch (report->id) {
786770
case 0x01: /* midi keys (qwerty)*/
787771
case 0x03: /* midi keyboard (musical)*/
788772
case 0x04: /* extra/midi keys (qwerty)*/
789-
ret = pcmidi_handle_report(pk->pm,
773+
ret = pcmidi_handle_report(pm,
790774
report->id, data, size);
791775
break;
792776
}
@@ -801,35 +785,24 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
801785
struct usb_interface *intf;
802786
unsigned short ifnum;
803787
unsigned long quirks = id->driver_data;
804-
struct pk_device *pk;
805-
struct pcmidi_snd *pm = NULL;
788+
struct pcmidi_snd *pm;
806789

807790
if (!hid_is_usb(hdev))
808791
return -EINVAL;
809792

810793
intf = to_usb_interface(hdev->dev.parent);
811794
ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
812795

813-
pk = kzalloc(sizeof(*pk), GFP_KERNEL);
814-
if (pk == NULL) {
815-
hid_err(hdev, "can't alloc descriptor\n");
816-
return -ENOMEM;
817-
}
818-
819-
pk->hdev = hdev;
820-
821796
pm = kzalloc(sizeof(*pm), GFP_KERNEL);
822797
if (pm == NULL) {
823798
hid_err(hdev, "can't alloc descriptor\n");
824-
ret = -ENOMEM;
825-
goto err_free_pk;
799+
return -ENOMEM;
826800
}
827801

828-
pm->pk = pk;
829-
pk->pm = pm;
802+
pm->hdev = hdev;
830803
pm->ifnum = ifnum;
831804

832-
hid_set_drvdata(hdev, pk);
805+
hid_set_drvdata(hdev, pm);
833806

834807
ret = hid_parse(hdev);
835808
if (ret) {
@@ -856,26 +829,18 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
856829
hid_hw_stop(hdev);
857830
err_free:
858831
kfree(pm);
859-
err_free_pk:
860-
kfree(pk);
861832

862833
return ret;
863834
}
864835

865836
static void pk_remove(struct hid_device *hdev)
866837
{
867-
struct pk_device *pk = hid_get_drvdata(hdev);
868-
struct pcmidi_snd *pm;
869-
870-
pm = pk->pm;
871-
if (pm) {
872-
pcmidi_snd_terminate(pm);
873-
kfree(pm);
874-
}
838+
struct pcmidi_snd *pm = hid_get_drvdata(hdev);
875839

840+
pcmidi_snd_terminate(pm);
876841
hid_hw_stop(hdev);
877842

878-
kfree(pk);
843+
kfree(pm);
879844
}
880845

881846
static const struct hid_device_id pk_devices[] = {

drivers/hid/wacom_wac.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ struct hid_data {
309309
bool confidence;
310310
int x;
311311
int y;
312-
int pressure;
313312
int width;
314313
int height;
315314
int id;

include/linux/hid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,9 @@ struct hid_device { /* device report descriptor */
683683

684684
unsigned int id; /* system unique id */
685685

686-
#ifdef CONFIG_BPF
686+
#ifdef CONFIG_HID_BPF
687687
struct hid_bpf bpf; /* hid-bpf data */
688-
#endif /* CONFIG_BPF */
688+
#endif /* CONFIG_HID_BPF */
689689
};
690690

691691
void hiddev_free(struct kref *ref);

0 commit comments

Comments
 (0)