Skip to content

Commit

Permalink
media: streamzap: remove unused struct members
Browse files Browse the repository at this point in the history
These struct members do not serve any purpose.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
seanyoung authored and mchehab committed Dec 14, 2021
1 parent 3508871 commit 4df69e4
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions drivers/media/rc/streamzap.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ struct streamzap_ir {
struct device *dev;

/* usb */
struct usb_device *usbdev;
struct usb_interface *interface;
struct usb_endpoint_descriptor *endpoint;
struct urb *urb_in;

/* buffer & dma */
Expand All @@ -85,7 +82,6 @@ struct streamzap_ir {
/* start time of signal; necessary for gap tracking */
ktime_t signal_last;
ktime_t signal_start;
bool timeout_enabled;

char phys[64];
};
Expand Down Expand Up @@ -240,8 +236,7 @@ static void streamzap_callback(struct urb *urb)
.duration = sz->rdev->timeout
};
sz->idle = true;
if (sz->timeout_enabled)
sz_push(sz, rawir);
sz_push(sz, rawir);
} else {
sz_push_full_space(sz, sz->buf_in[i]);
}
Expand All @@ -263,7 +258,8 @@ static void streamzap_callback(struct urb *urb)
usb_submit_urb(urb, GFP_ATOMIC);
}

static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz,
struct usb_device *usbdev)
{
struct rc_dev *rdev;
struct device *dev = sz->dev;
Expand All @@ -273,12 +269,12 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
if (!rdev)
goto out;

usb_make_path(sz->usbdev, sz->phys, sizeof(sz->phys));
usb_make_path(usbdev, sz->phys, sizeof(sz->phys));
strlcat(sz->phys, "/input0", sizeof(sz->phys));

rdev->device_name = "Streamzap PC Remote Infrared Receiver";
rdev->input_phys = sz->phys;
usb_to_input_id(sz->usbdev, &rdev->input_id);
usb_to_input_id(usbdev, &rdev->input_id);
rdev->dev.parent = dev;
rdev->priv = sz;
rdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
Expand Down Expand Up @@ -310,6 +306,7 @@ static int streamzap_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *usbdev = interface_to_usbdev(intf);
struct usb_endpoint_descriptor *endpoint;
struct usb_host_interface *iface_host;
struct streamzap_ir *sz = NULL;
int retval = -ENOMEM;
Expand All @@ -320,9 +317,6 @@ static int streamzap_probe(struct usb_interface *intf,
if (!sz)
return -ENOMEM;

sz->usbdev = usbdev;
sz->interface = intf;

/* Check to ensure endpoint information matches requirements */
iface_host = intf->cur_altsetting;

Expand All @@ -333,22 +327,22 @@ static int streamzap_probe(struct usb_interface *intf,
goto free_sz;
}

sz->endpoint = &(iface_host->endpoint[0].desc);
if (!usb_endpoint_dir_in(sz->endpoint)) {
endpoint = &iface_host->endpoint[0].desc;
if (!usb_endpoint_dir_in(endpoint)) {
dev_err(&intf->dev, "%s: endpoint doesn't match input device 02%02x\n",
__func__, sz->endpoint->bEndpointAddress);
__func__, endpoint->bEndpointAddress);
retval = -ENODEV;
goto free_sz;
}

if (!usb_endpoint_xfer_int(sz->endpoint)) {
if (!usb_endpoint_xfer_int(endpoint)) {
dev_err(&intf->dev, "%s: endpoint attributes don't match xfer 02%02x\n",
__func__, sz->endpoint->bmAttributes);
__func__, endpoint->bmAttributes);
retval = -ENODEV;
goto free_sz;
}

pipe = usb_rcvintpipe(usbdev, sz->endpoint->bEndpointAddress);
pipe = usb_rcvintpipe(usbdev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(usbdev, pipe, usb_pipeout(pipe));

if (maxp == 0) {
Expand All @@ -370,14 +364,13 @@ static int streamzap_probe(struct usb_interface *intf,
sz->dev = &intf->dev;
sz->buf_in_len = maxp;

sz->rdev = streamzap_init_rc_dev(sz);
sz->rdev = streamzap_init_rc_dev(sz, usbdev);
if (!sz->rdev)
goto rc_dev_fail;

sz->idle = true;
sz->decoder_state = PulseSpace;
/* FIXME: don't yet have a way to set this */
sz->timeout_enabled = true;
sz->rdev->timeout = SZ_TIMEOUT * SZ_RESOLUTION;
#if 0
/* not yet supported, depends on patches from maxim */
Expand All @@ -390,8 +383,7 @@ static int streamzap_probe(struct usb_interface *intf,

/* Complete final initialisations */
usb_fill_int_urb(sz->urb_in, usbdev, pipe, sz->buf_in,
maxp, (usb_complete_t)streamzap_callback,
sz, sz->endpoint->bInterval);
maxp, streamzap_callback, sz, endpoint->bInterval);
sz->urb_in->transfer_dma = sz->dma_in;
sz->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

Expand Down Expand Up @@ -432,7 +424,6 @@ static void streamzap_disconnect(struct usb_interface *interface)
if (!sz)
return;

sz->usbdev = NULL;
rc_unregister_device(sz->rdev);
usb_kill_urb(sz->urb_in);
usb_free_urb(sz->urb_in);
Expand Down

0 comments on commit 4df69e4

Please sign in to comment.