From patchwork Mon Oct 31 10:48:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 9405257 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 9972D60585 for ; Mon, 31 Oct 2016 10:50:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C772919C for ; Mon, 31 Oct 2016 10:50:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BFBA291A2; Mon, 31 Oct 2016 10:50:05 +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.9 required=2.0 tests=BAYES_00,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 010CD2919C for ; Mon, 31 Oct 2016 10:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935113AbcJaKuC (ORCPT ); Mon, 31 Oct 2016 06:50:02 -0400 Received: from mga04.intel.com ([192.55.52.120]:24971 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934983AbcJaKuB (ORCPT ); Mon, 31 Oct 2016 06:50:01 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 31 Oct 2016 03:50:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="1052893988" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by orsmga001.jf.intel.com with ESMTP; 31 Oct 2016 03:49:59 -0700 From: Felipe Balbi To: Linux USB Cc: Felipe Balbi , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 13/82] media: usbtv: core: make use of new usb_endpoint_maxp_mult() Date: Mon, 31 Oct 2016 12:48:05 +0200 Message-Id: <20161031104914.1990-14-felipe.balbi@linux.intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161031104914.1990-1-felipe.balbi@linux.intel.com> References: <20161031104914.1990-1-felipe.balbi@linux.intel.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have introduced a helper to calculate multiplier value from wMaxPacketSize. Start using it. Cc: Mauro Carvalho Chehab Cc: Signed-off-by: Felipe Balbi --- drivers/media/usb/usbtv/usbtv-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c index dc76fd41e00f..ceb953be0770 100644 --- a/drivers/media/usb/usbtv/usbtv-core.c +++ b/drivers/media/usb/usbtv/usbtv-core.c @@ -71,6 +71,7 @@ static int usbtv_probe(struct usb_interface *intf, int size; struct device *dev = &intf->dev; struct usbtv *usbtv; + struct usb_host_endpoint *ep; /* Checks that the device is what we think it is. */ if (intf->num_altsetting != 2) @@ -78,10 +79,12 @@ static int usbtv_probe(struct usb_interface *intf, if (intf->altsetting[1].desc.bNumEndpoints != 4) return -ENODEV; + ep = &intf->altsetting[1].endpoint[0]; + /* Packet size is split into 11 bits of base size and count of * extra multiplies of it.*/ - size = usb_endpoint_maxp(&intf->altsetting[1].endpoint[0].desc); - size = (size & 0x07ff) * (((size & 0x1800) >> 11) + 1); + size = usb_endpoint_maxp(&ep->desc); + size = (size & 0x07ff) * usb_endpoint_maxp_mult(&ep->desc); /* Device structure */ usbtv = kzalloc(sizeof(struct usbtv), GFP_KERNEL);