* [PATCH -hg] Build fix for mercurial tree
@ 2010-05-13 18:43 Mauro Carvalho Chehab
2010-05-13 19:01 ` Douglas Schilling Landgraf
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2010-05-13 18:43 UTC (permalink / raw)
To: Douglas Landgraf; +Cc: Linux Media Mailing List
Fix backport tree compilations with kernels older than 2.6.33.
Compile tested only, with 2.6.32.4 kernel.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/linux/drivers/media/IR/ir-core-priv.h b/linux/drivers/media/IR/ir-core-priv.h
--- a/linux/drivers/media/IR/ir-core-priv.h
+++ b/linux/drivers/media/IR/ir-core-priv.h
@@ -28,7 +28,11 @@ struct ir_raw_handler {
struct ir_raw_event_ctrl {
struct work_struct rx_work; /* for the rx decoding workqueue */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+ struct kfifo *kfifo; /* fifo for the pulse/space durations */
+#else
struct kfifo kfifo; /* fifo for the pulse/space durations */
+#endif
ktime_t last_event; /* when last event occurred */
enum raw_event_type last_type; /* last event type */
struct input_dev *input_dev; /* pointer to the parent input_dev */
diff --git a/linux/drivers/media/IR/ir-raw-event.c b/linux/drivers/media/IR/ir-raw-event.c
--- a/linux/drivers/media/IR/ir-raw-event.c
+++ b/linux/drivers/media/IR/ir-raw-event.c
@@ -61,8 +61,13 @@ static void ir_raw_event_work(struct wor
struct ir_raw_event_ctrl *raw =
container_of(work, struct ir_raw_event_ctrl, rx_work);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+ while (kfifo_get(raw->kfifo, (void *)&ev, sizeof(ev)) == sizeof(ev))
+ RUN_DECODER(decode, raw->input_dev, ev);
+#else
while (kfifo_out(&raw->kfifo, &ev, sizeof(ev)) == sizeof(ev))
RUN_DECODER(decode, raw->input_dev, ev);
+#endif
}
int ir_raw_event_register(struct input_dev *input_dev)
@@ -77,8 +82,15 @@ int ir_raw_event_register(struct input_d
ir->raw->input_dev = input_dev;
INIT_WORK(&ir->raw->rx_work, ir_raw_event_work);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+ ir->raw->kfifo = kfifo_alloc(sizeof(s64) * MAX_IR_EVENT_SIZE,
+ GFP_KERNEL, NULL);
+ if (ir->raw->kfifo == NULL)
+ rc = -ENOMEM;
+#else
rc = kfifo_alloc(&ir->raw->kfifo, sizeof(s64) * MAX_IR_EVENT_SIZE,
GFP_KERNEL);
+#endif
if (rc < 0) {
kfree(ir->raw);
ir->raw = NULL;
@@ -87,7 +99,11 @@ int ir_raw_event_register(struct input_d
rc = RUN_DECODER(raw_register, input_dev);
if (rc < 0) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+ kfifo_free(ir->raw->kfifo);
+#else
kfifo_free(&ir->raw->kfifo);
+#endif
kfree(ir->raw);
ir->raw = NULL;
return rc;
@@ -106,7 +122,11 @@ void ir_raw_event_unregister(struct inpu
cancel_work_sync(&ir->raw->rx_work);
RUN_DECODER(raw_unregister, input_dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+ kfifo_free(ir->raw->kfifo);
+#else
kfifo_free(&ir->raw->kfifo);
+#endif
kfree(ir->raw);
ir->raw = NULL;
}
@@ -128,8 +148,13 @@ int ir_raw_event_store(struct input_dev
if (!ir->raw)
return -EINVAL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+ if (kfifo_put(ir->raw->kfifo, (void *)ev, sizeof(*ev)) != sizeof(*ev))
+ return -ENOMEM;
+#else
if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev))
return -ENOMEM;
+#endif
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH -hg] Build fix for mercurial tree
2010-05-13 18:43 [PATCH -hg] Build fix for mercurial tree Mauro Carvalho Chehab
@ 2010-05-13 19:01 ` Douglas Schilling Landgraf
0 siblings, 0 replies; 2+ messages in thread
From: Douglas Schilling Landgraf @ 2010-05-13 19:01 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List
On Thu, May 13, 2010 at 3:43 PM, Mauro Carvalho Chehab
<mchehab@redhat.com> wrote:
> Fix backport tree compilations with kernels older than 2.6.33.
>
> Compile tested only, with 2.6.32.4 kernel.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
>
> diff --git a/linux/drivers/media/IR/ir-core-priv.h b/linux/drivers/media/IR/ir-core-priv.h
> --- a/linux/drivers/media/IR/ir-core-priv.h
> +++ b/linux/drivers/media/IR/ir-core-priv.h
> @@ -28,7 +28,11 @@ struct ir_raw_handler {
>
> struct ir_raw_event_ctrl {
> struct work_struct rx_work; /* for the rx decoding workqueue */
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
> + struct kfifo *kfifo; /* fifo for the pulse/space durations */
> +#else
> struct kfifo kfifo; /* fifo for the pulse/space durations */
> +#endif
> ktime_t last_event; /* when last event occurred */
> enum raw_event_type last_type; /* last event type */
> struct input_dev *input_dev; /* pointer to the parent input_dev */
> diff --git a/linux/drivers/media/IR/ir-raw-event.c b/linux/drivers/media/IR/ir-raw-event.c
> --- a/linux/drivers/media/IR/ir-raw-event.c
> +++ b/linux/drivers/media/IR/ir-raw-event.c
> @@ -61,8 +61,13 @@ static void ir_raw_event_work(struct wor
> struct ir_raw_event_ctrl *raw =
> container_of(work, struct ir_raw_event_ctrl, rx_work);
>
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
> + while (kfifo_get(raw->kfifo, (void *)&ev, sizeof(ev)) == sizeof(ev))
> + RUN_DECODER(decode, raw->input_dev, ev);
> +#else
> while (kfifo_out(&raw->kfifo, &ev, sizeof(ev)) == sizeof(ev))
> RUN_DECODER(decode, raw->input_dev, ev);
> +#endif
> }
>
> int ir_raw_event_register(struct input_dev *input_dev)
> @@ -77,8 +82,15 @@ int ir_raw_event_register(struct input_d
> ir->raw->input_dev = input_dev;
> INIT_WORK(&ir->raw->rx_work, ir_raw_event_work);
>
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
> + ir->raw->kfifo = kfifo_alloc(sizeof(s64) * MAX_IR_EVENT_SIZE,
> + GFP_KERNEL, NULL);
> + if (ir->raw->kfifo == NULL)
> + rc = -ENOMEM;
> +#else
> rc = kfifo_alloc(&ir->raw->kfifo, sizeof(s64) * MAX_IR_EVENT_SIZE,
> GFP_KERNEL);
> +#endif
> if (rc < 0) {
> kfree(ir->raw);
> ir->raw = NULL;
> @@ -87,7 +99,11 @@ int ir_raw_event_register(struct input_d
>
> rc = RUN_DECODER(raw_register, input_dev);
> if (rc < 0) {
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
> + kfifo_free(ir->raw->kfifo);
> +#else
> kfifo_free(&ir->raw->kfifo);
> +#endif
> kfree(ir->raw);
> ir->raw = NULL;
> return rc;
> @@ -106,7 +122,11 @@ void ir_raw_event_unregister(struct inpu
> cancel_work_sync(&ir->raw->rx_work);
> RUN_DECODER(raw_unregister, input_dev);
>
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
> + kfifo_free(ir->raw->kfifo);
> +#else
> kfifo_free(&ir->raw->kfifo);
> +#endif
> kfree(ir->raw);
> ir->raw = NULL;
> }
> @@ -128,8 +148,13 @@ int ir_raw_event_store(struct input_dev
> if (!ir->raw)
> return -EINVAL;
>
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
> + if (kfifo_put(ir->raw->kfifo, (void *)ev, sizeof(*ev)) != sizeof(*ev))
> + return -ENOMEM;
> +#else
> if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev))
> return -ENOMEM;
> +#endif
>
> return 0;
> }
>
>
Applied, thanks.
Cheers
Douglas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-13 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 18:43 [PATCH -hg] Build fix for mercurial tree Mauro Carvalho Chehab
2010-05-13 19:01 ` Douglas Schilling Landgraf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox