From patchwork Wed Jul 18 08:45:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guido Kiener X-Patchwork-Id: 10531543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B76B360631 for ; Wed, 18 Jul 2018 07:54:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F37291C6 for ; Wed, 18 Jul 2018 07:54:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D2A3291C8; Wed, 18 Jul 2018 07:54:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28514291C7 for ; Wed, 18 Jul 2018 07:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729706AbeGRIao (ORCPT ); Wed, 18 Jul 2018 04:30:44 -0400 Received: from mr07.mx01.tldhost.de ([62.108.44.247]:46738 "EHLO mr07.mx01.tldhost.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729251AbeGRIan (ORCPT ); Wed, 18 Jul 2018 04:30:43 -0400 Received: from mx01.tldhost.de (localhost [127.0.0.1]) by mx01.tldhost.de (Postfix) with ESMTP id C756D120ED9 for ; Wed, 18 Jul 2018 09:48:13 +0200 (CEST) Received: by mx01.tldhost.de (Postfix, from userid 1001) id BD1FC120EC4; Wed, 18 Jul 2018 09:48:13 +0200 (CEST) Received: from server12.tldhost.de (server12.tldhost.de [84.19.26.112]) by mx01.tldhost.de (Postfix) with ESMTPS id B5C2B120EB4; Wed, 18 Jul 2018 09:48:11 +0200 (CEST) From: Guido Kiener To: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, guido.kiener@rohde-schwarz.com, steve_bayless@keysight.com, dpenkler@gmail.com Cc: Guido Kiener Subject: [PATCH v2 07/29] usb: usbtmc: Add support for 32 bit compat applications Date: Wed, 18 Jul 2018 10:45:40 +0200 Message-Id: <20180718084602.10568-8-guido@kiener-muenchen.de> In-Reply-To: <20180718084602.10568-1-guido@kiener-muenchen.de> References: <20180718084602.10568-1-guido@kiener-muenchen.de> X-PPP-Message-ID: <20180718074812.13174.21277@server12.tldhost.de> X-PPP-Vhost: kiener-muenchen.de X-POWERED-BY: TLDHost.de - AV:CLEAN SPAM:OK Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 32 bit applications can only call ioctl functions on 64 bit systems when the field .compat_ioctl is defined for file operations. Tested-by: Dave Penkler Signed-off-by: Guido Kiener Reviewed-by: Steve Bayless --- drivers/usb/class/usbtmc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 1b7b2e402adb..d685db78b80b 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -1423,6 +1424,14 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return retval; } +#ifdef CONFIG_COMPAT +static long usbtmc_compat_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + return usbtmc_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int usbtmc_fasync(int fd, struct file *file, int on) { struct usbtmc_file_data *file_data = file->private_data; @@ -1459,6 +1468,9 @@ static const struct file_operations fops = { .open = usbtmc_open, .release = usbtmc_release, .unlocked_ioctl = usbtmc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = usbtmc_compat_ioctl, +#endif .fasync = usbtmc_fasync, .poll = usbtmc_poll, .llseek = default_llseek,