From patchwork Fri Dec 13 22:24:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22449 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 10A6D24006 for ; Fri, 13 Dec 2013 22:28:19 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z6sf4759905yhz.7 for ; Fri, 13 Dec 2013 14:28:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=9JSLQ6zB4r64ZUIVQ1ftmUA4FaiVQ4zVvgyaB3LgKb8=; b=gu+MfirgSe21dM701NWmGhFRFrWC3WhLdfZuE6Fv83UuOYndMTFa/wV2WNFIIMU1LM CMeXfEGNeKaG40+mmZw8hPUfxUeMRNQvMuOvhS4IP3IlWSyyRbCDaQG0wZyeAo+UuAAV nq14eYEvX/O7GLk+1smqiV5WJUx/YeEGnHYsrD0l/MHcARjl5E4ThCQCXdn2aolpO6tV paDJQin0ntGlqss8/n1XoOaJpeYFnDDt7JrBviv9FQPgPpnQKeejcWuzkX9pRtlH84V4 WOGdIMnHIstqSrpXRKudYLwRi9Fht2k9AWDSpdBR3qXIYR8PH9mnh000B922i6atY/eO PRyA== X-Gm-Message-State: ALoCoQkzSNaWhznuDVlYRfWIUEH/sdT1TnC4dCunlFnkboidZ5kUKfc7LhM9vzHG54jUMyk+5vlw X-Received: by 10.236.92.107 with SMTP id i71mr1555526yhf.1.1386973698881; Fri, 13 Dec 2013 14:28:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.103.136 with SMTP id fw8ls1189439qeb.20.gmail; Fri, 13 Dec 2013 14:28:18 -0800 (PST) X-Received: by 10.220.169.203 with SMTP id a11mr2193172vcz.26.1386973698484; Fri, 13 Dec 2013 14:28:18 -0800 (PST) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id tl2si1185814vdc.142.2013.12.13.14.28.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:28:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu19so1762691vcb.0 for ; Fri, 13 Dec 2013 14:28:18 -0800 (PST) X-Received: by 10.220.189.2 with SMTP id dc2mr492140vcb.60.1386973698406; Fri, 13 Dec 2013 14:28:18 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp73621vcz; Fri, 13 Dec 2013 14:28:18 -0800 (PST) X-Received: by 10.67.22.38 with SMTP id hp6mr5988219pad.53.1386973697273; Fri, 13 Dec 2013 14:28:17 -0800 (PST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id d2si2486746pba.301.2013.12.13.14.28.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:28:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id g10so3030240pdj.31 for ; Fri, 13 Dec 2013 14:28:16 -0800 (PST) X-Received: by 10.66.25.36 with SMTP id z4mr5987625paf.101.1386973696872; Fri, 13 Dec 2013 14:28:16 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qz9sm7457908pbc.3.2013.12.13.14.28.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:28:16 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , John Stultz Subject: [PATCH 084/115] ion: Fix compat support to use proper compat ioctl numbers Date: Fri, 13 Dec 2013 14:24:58 -0800 Message-Id: <1386973529-4884-85-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The compat support added to ion didn't provide compat ioctl numbers (who's value depends on the compat structure size). So 32bit applications would get an error when trying to make ioctl calls. This patch adds the needed COMPAT_ macros and uses them in the compat_ion_ioctl, translating them to their non-compat cmd when calling the normal ioctl call. Signed-off-by: John Stultz --- drivers/staging/android/ion/compat_ion.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c index d4a33c7..079a5bb 100644 --- a/drivers/staging/android/ion/compat_ion.c +++ b/drivers/staging/android/ion/compat_ion.c @@ -35,6 +35,12 @@ struct compat_ion_custom_data { compat_ulong_t arg; }; +#define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ + struct compat_ion_allocation_data) +#define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) +#define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \ + struct compat_ion_custom_data) + static int compat_get_ion_allocation_data( struct compat_ion_allocation_data __user *data32, struct ion_allocation_data __user *data) @@ -105,7 +111,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return -ENOTTY; switch (cmd) { - case ION_IOC_ALLOC: + case COMPAT_ION_IOC_ALLOC: { struct compat_ion_allocation_data __user *data32; struct ion_allocation_data __user *data; @@ -119,13 +125,12 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) err = compat_get_ion_allocation_data(data32, data); if (err) return err; - - ret = filp->f_op->unlocked_ioctl(filp, cmd, + ret = filp->f_op->unlocked_ioctl(filp, ION_IOC_ALLOC, (unsigned long)data); err = compat_put_ion_allocation_data(data32, data); return ret ? ret : err; } - case ION_IOC_FREE: + case COMPAT_ION_IOC_FREE: { struct compat_ion_allocation_data __user *data32; struct ion_allocation_data __user *data; @@ -140,10 +145,10 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (err) return err; - return filp->f_op->unlocked_ioctl(filp, cmd, + return filp->f_op->unlocked_ioctl(filp, ION_IOC_FREE, (unsigned long)data); } - case ION_IOC_CUSTOM: { + case COMPAT_ION_IOC_CUSTOM: { struct compat_ion_custom_data __user *data32; struct ion_custom_data __user *data; int err; @@ -157,7 +162,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (err) return err; - return filp->f_op->unlocked_ioctl(filp, cmd, + return filp->f_op->unlocked_ioctl(filp, ION_IOC_CUSTOM, (unsigned long)data); } case ION_IOC_SHARE: