From patchwork Wed May 31 20:59:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9758145 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 34F2F60390 for ; Wed, 31 May 2017 21:01:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 284FB2844E for ; Wed, 31 May 2017 21:01:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BC90284C0; Wed, 31 May 2017 21:01:56 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 BFE9D2844E for ; Wed, 31 May 2017 21:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbdEaVBU (ORCPT ); Wed, 31 May 2017 17:01:20 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35408 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbdEaU77 (ORCPT ); Wed, 31 May 2017 16:59:59 -0400 Received: by mail-pf0-f194.google.com with SMTP id u26so4177085pfd.2; Wed, 31 May 2017 13:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sGznCqDhHeoR9865XxYZG8zd8RvV9aIrfmhbx+SswAQ=; b=ItVQmRZo2sSpr14/XyAm6evjRq/8dj76WI3N+UfYShaIOQsJuyyJWDLGbayWBoZd99 TW4HpqzD4Y76pDxlCKiqG5xbKvJKuY0xu/oIs5yS5LrvhuK1pm2b7j1svvd31cuUy4J9 6xQrogT/fTyf7bVDnbphLvc6ZY+VwrDsd83ZEqUBOKa0/t6eToFyTZ9XvwgZmKZA7pr2 0hl4CDRP5kt+MLyfdvpe3f5+uAvs7YPUycUJjnztyouK88k5U+PiIBVL37rIr+UnK6dA kt7qaefN2hCuMpfwP+FiRSfGpfnboIUXJvzrDtk9ODihEgqyNOR1LiySYyajL6WDQIeG h4QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sGznCqDhHeoR9865XxYZG8zd8RvV9aIrfmhbx+SswAQ=; b=YEJd6uS5Ic/3KG2wX09JBuDzjoIhKaWlQPqI3CvPQ4SOVIjuDaUSCK2SY0aMJDKk+3 xwrWKfn60r+c4R2jK99WCghwpKxXf5WXkVE1kx7qjo92ioDGnadY93fvj6z2O4DfEJrv k47gqXtDCQYf10D7AUM0Mx3GgMcF1jsaOhHwvN/Q2Zs6fBtYrAdW9OC9sD3NcdhevDww xwFZlh6FQrPUoRlsV+1BMuStkfwNmKZ87BZg2NNljlabyMysREiDTydxq4nSpSkO5Ymi oJok2xAE3NgI1hzvg8AUcS3FFQkFTKzTom8MC8zfnvEE5BQALp5sVhrTtnfMRPvfQmdO tstA== X-Gm-Message-State: AODbwcA03ylvwUqurf83SeWcbhiyIqMf+Br7k0HsZosQfxTemKnZXxk2 bV4gsHAKiwEEGA== X-Received: by 10.99.103.70 with SMTP id b67mr35417519pgc.96.1496264393863; Wed, 31 May 2017 13:59:53 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([172.22.152.34]) by smtp.gmail.com with ESMTPSA id i5sm28547444pfj.41.2017.05.31.13.59.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 May 2017 13:59:53 -0700 (PDT) From: Dmitry Torokhov To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] HID: hiddev: use hid_hw_open/close instead of usbhid_open/close Date: Wed, 31 May 2017 13:59:45 -0700 Message-Id: <20170531205951.30852-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.13.0.506.g27d5fe0cd-goog In-Reply-To: <20170531205951.30852-1-dmitry.torokhov@gmail.com> References: <20170531205951.30852-1-dmitry.torokhov@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of calling into usbhid code directly, let's use the standard accessors for the transport HID drivers. This also allows us make usbhid_open and close static. Signed-off-by: Dmitry Torokhov --- drivers/hid/usbhid/hid-core.c | 4 ++-- drivers/hid/usbhid/hiddev.c | 8 ++++---- drivers/hid/usbhid/usbhid.h | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 83772fa7d92a..fb0cf5d70504 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -677,7 +677,7 @@ static int hid_get_class_descriptor(struct usb_device *dev, int ifnum, return result; } -int usbhid_open(struct hid_device *hid) +static int usbhid_open(struct hid_device *hid) { struct usbhid_device *usbhid = hid->driver_data; int res = 0; @@ -722,7 +722,7 @@ int usbhid_open(struct hid_device *hid) return res; } -void usbhid_close(struct hid_device *hid) +static void usbhid_close(struct hid_device *hid) { struct usbhid_device *usbhid = hid->driver_data; diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 0e06368d1fbb..d949ac13af9e 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -237,7 +237,7 @@ static int hiddev_release(struct inode * inode, struct file * file) mutex_lock(&list->hiddev->existancelock); if (!--list->hiddev->open) { if (list->hiddev->exist) { - usbhid_close(list->hiddev->hid); + hid_hw_close(list->hiddev->hid); usbhid_put_power(list->hiddev->hid); } else { mutex_unlock(&list->hiddev->existancelock); @@ -282,7 +282,7 @@ static int hiddev_open(struct inode *inode, struct file *file) */ if (list->hiddev->exist) { if (!list->hiddev->open++) { - res = usbhid_open(hiddev->hid); + res = hid_hw_open(hiddev->hid); if (res < 0) { res = -EIO; goto bail; @@ -306,7 +306,7 @@ static int hiddev_open(struct inode *inode, struct file *file) res = -EIO; goto bail_unlock; } - usbhid_open(hid); + hid_hw_open(hid); } mutex_unlock(&hiddev->existancelock); return 0; @@ -935,7 +935,7 @@ void hiddev_disconnect(struct hid_device *hid) if (hiddev->open) { mutex_unlock(&hiddev->existancelock); - usbhid_close(hiddev->hid); + hid_hw_close(hiddev->hid); wake_up_interruptible(&hiddev->wait); } else { mutex_unlock(&hiddev->existancelock); diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index fa47d666cfcf..83ef5c14aa92 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h @@ -34,8 +34,6 @@ #include /* API provided by hid-core.c for USB HID drivers */ -void usbhid_close(struct hid_device *hid); -int usbhid_open(struct hid_device *hid); void usbhid_init_reports(struct hid_device *hid); int usbhid_get_power(struct hid_device *hid); void usbhid_put_power(struct hid_device *hid);