public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manu Abraham <abraham.manu@gmail.com>
To: linux-kernel@vger.kernel.org, v4l-dvb-maintainer@linuxtv.org,
	akpm@linux-foundation.org
Cc: Marco Schluessler <marco@lordzodiac.de>
Subject: DVB Update [PATCH 10/31] multiproto tree
Date: Thu, 04 Sep 2008 22:38:01 +0400	[thread overview]
Message-ID: <48C02B09.50101@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

>From 15f5071d056f457609153d2c707bf0fe18909bd6 Mon Sep 17 00:00:00 2001
From: Manu Abraham <manu@linuxtv.org>
Date: Thu, 4 Sep 2008 12:37:31 +0200
Subject: [PATCH] DVB Fix DVBFE_GET_EVENT backward compatibility

* DVBFE_GET_EVENT ioctl's backward compatibility was broken due
to a size difference of the data structure.

The patch fixes the backward compatibility for this ioctl.

From: Marco Schluessler <marco@lordzodiac.de>
Signed-off-by: Marco Schluessler <marco@lordzodiac.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>

 drivers/media/dvb/dvb-core/dvb_frontend.c |   29
+++++++++++++++++++++++------
 drivers/media/dvb/dvb-core/dvb_frontend.h |    9 ++++++++-
 include/linux/dvb/frontend.h              |    6 +++++-
 3 files changed, 36 insertions(+), 8 deletions(-)

[-- Attachment #2: 10.patch --]
[-- Type: text/x-patch, Size: 4572 bytes --]

>From 15f5071d056f457609153d2c707bf0fe18909bd6 Mon Sep 17 00:00:00 2001
From: Manu Abraham <manu@linuxtv.org>
Date: Thu, 4 Sep 2008 12:37:31 +0200
Subject: [PATCH] DVB Fix DVBFE_GET_EVENT backward compatibility

* DVBFE_GET_EVENT ioctl's backward compatibility was broken due
to a size difference of the data structure.

The patch fixes the backward compatibility for this ioctl.

From: Marco Schluessler <marco@lordzodiac.de>
Signed-off-by: Marco Schluessler <marco@lordzodiac.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index ac224db..202a0de 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -569,7 +569,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
 {
 	struct dvb_frontend_private *fepriv = fe->frontend_priv;
 	struct dvb_fe_events *events = &fepriv->events;
-	struct dvb_frontend_event *e;
+	struct dvb_frontend_event_int *e;
 	int wp;
 
 	dprintk ("%s\n", __func__);
@@ -679,7 +679,7 @@ static int dvbfe_sanity_check(struct dvb_frontend *fe)
 }
 
 static int dvb_frontend_get_event(struct dvb_frontend *fe,
-			    struct dvb_frontend_event *event, int flags)
+			    struct dvb_frontend_event_int *event, int flags)
 {
 	struct dvb_frontend_private *fepriv = fe->frontend_priv;
 	struct dvb_fe_events *events = &fepriv->events;
@@ -713,7 +713,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe,
 		return -ERESTARTSYS;
 
 	memcpy (event, &events->events[events->eventr],
-		sizeof(struct dvb_frontend_event));
+		sizeof(struct dvb_frontend_event_int));
 
 	events->eventr = (events->eventr + 1) % MAX_EVENT;
 
@@ -1436,7 +1436,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
 		return -ENODEV;
 
 	if ((file->f_flags & O_ACCMODE) == O_RDONLY &&
-	    (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT ||
+	    (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT || cmd == DVBFE_GET_EVENT ||
 	     cmd == FE_DISEQC_RECV_SLAVE_REPLY))
 		return -EPERM;
 
@@ -1675,9 +1675,16 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
 		break;
 	}
 
-	case FE_GET_EVENT:
-		err = dvb_frontend_get_event (fe, parg, file->f_flags);
+	case FE_GET_EVENT: {
+		struct dvb_frontend_event_int event;
+		struct dvb_frontend_event *out_event = parg;
+
+		if (!(err = dvb_frontend_get_event(fe, &event, file->f_flags))) {
+			out_event->status = event.status;
+			memcpy(&out_event->parameters, &event.parameters, sizeof (struct dvb_frontend_event));
+		}
 		break;
+	}
 
 	case FE_GET_FRONTEND:
 		fe->legacy = 1;
@@ -1692,6 +1699,16 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
 		err = 0;
 		break;
 
+	case DVBFE_GET_EVENT: {
+		struct dvb_frontend_event_int event;
+		struct dvbfe_event *out_event = parg;
+
+		if (!(err = dvb_frontend_get_event(fe, &event, file->f_flags))) {
+			memcpy(&out_event->fe_events, &event.fe_events, sizeof (struct dvbfe_events));
+			memcpy(&out_event->fe_params, &event.fe_params, sizeof (struct dvb_frontend_event));
+		}
+		break;
+	}
 	case DVBFE_SET_PARAMS: {
 		struct dvb_frontend_tune_settings fetunesettings;
 		enum dvbfe_delsys delsys = fepriv->fe_info.delivery;
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 8066ff0..6358ddd 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -309,8 +309,15 @@ struct dvb_frontend_ops {
 
 #define MAX_EVENT 8
 
+struct dvb_frontend_event_int {
+	fe_status_t status;
+	struct dvb_frontend_parameters parameters;
+	struct dvbfe_events fe_events;
+	struct dvbfe_params fe_params;
+};
+
 struct dvb_fe_events {
-	struct dvb_frontend_event events[MAX_EVENT];
+	struct dvb_frontend_event_int events[MAX_EVENT];
 	int			  eventw;
 	int			  eventr;
 	int			  overflow;
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index b17c218..73f391d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -641,9 +641,13 @@ struct dvbfe_events {
 struct dvb_frontend_event {
 	fe_status_t status;
 	struct dvb_frontend_parameters parameters;
+};
+#define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
+
+struct dvbfe_event {
 	struct dvbfe_events fe_events;
 	struct dvbfe_params fe_params;
 };
-#define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
+#define DVBFE_GET_EVENT			_IOR('o', 86, struct dvbfe_event)
 
 #endif /*_DVBFRONTEND_H_*/

                 reply	other threads:[~2008-09-04 18:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48C02B09.50101@gmail.com \
    --to=abraham.manu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco@lordzodiac.de \
    --cc=v4l-dvb-maintainer@linuxtv.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