Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4126545pxu; Mon, 30 Nov 2020 18:45:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6KnfdkPsixoe1+avhI5BhT9WIwEduU1b8SSxFTfY2HoyO3JtKcOcui0uRNOU/Sf+cmewP X-Received: by 2002:a17:907:6e6:: with SMTP id yh6mr968552ejb.512.1606790748865; Mon, 30 Nov 2020 18:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606790748; cv=none; d=google.com; s=arc-20160816; b=B1M7+cDB2+oXCQz7Eagks52xPWVybyyOZXOFaddDojy+6A7yaxI3E6ER2pSvYZpF+R WKrfIaKAPsJEBu+KgpSYx/N0T/Fd1Zh1Pxc4AUhkmv0su+Esj3YqJpkyVd6u5dYCyEEr 3kJntwMWHyJvcS1UI9EXM3oboWH6GpPCg9EvHRPufo6jm6cSxndEK76xhoP6VU0DzXpf w5zj39PWdE7DskGOQj23ke3q2h11qzpHiPqBr45z6UYwOSu/UFB5rh5UhwjrX1okLdyH 1bmN78JWGSqfdbQ0YRH2+8u/6kHdWtZpxdlJ4UpyGOLWShht65EaZHHKEo6wFtTtk6zg VaVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YzRoQK48hdn26VwNICKcMxppEh6YmVkly2mV0TpEsRM=; b=Etssw4FGt7CL8SWO47leUFJvIw2jp8Jv6F1uuX6yymO9LTPhL7r+fSQZX7twRmdI+k r4EkC8CMyNI9mLpMbgrkNl9Sxu57WuREg+pZnUuob4M1zMiBYfFnlclslJY36Xh9Ppcn 1qrw1ajSilFkoxullCNLOSCw06c3hcOHpv/gJBEKAhFjSi+nD4A2+hPHb102rjVxq7OG DKyN2Dng/LF15Xmq2RRE1zIQTmoud79aSwi7oSxtxYc5QOTOwKsE8XdjNsrLNBvdSxki kOdnBKGhzgPZCug0FIQJQSPxSBsbUjEByQteON0oUcV5WeSEZslZgamkyN2W8bPoaUk2 WqCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xsg1VUul; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si88824ejm.470.2020.11.30.18.45.26; Mon, 30 Nov 2020 18:45:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xsg1VUul; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726566AbgLACIb (ORCPT + 99 others); Mon, 30 Nov 2020 21:08:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgLACIa (ORCPT ); Mon, 30 Nov 2020 21:08:30 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A00A1C0613CF; Mon, 30 Nov 2020 18:07:50 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id k5so219509plt.6; Mon, 30 Nov 2020 18:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YzRoQK48hdn26VwNICKcMxppEh6YmVkly2mV0TpEsRM=; b=Xsg1VUulHwkQfdILKkBsYjqHAtcrFzXA6wZ05axioxZiTH4XBlkHSJaOmjs74Z5Xd9 76ccBwPaFGtNxtJwy+Nd651I1jEAJPLZYY2qKUQSLa54aQRpL+YqV8yT0JSPZLqbJP6n UiEyhlPNkzyGCBzBI00H3tiHDVlfyg/vTBzObX2lLmjLp5eYaBAESZOAyoxN0qNkElZH e3zjD+lSk04DbNrtlwybURtZb+kF4jhr3VRz2EmDI07woZYC+ZlxTyQxrNut10Ts6g6a Uvu4zuHEJ1mGgt+OmZv94p/L106k8ahnS+4Nr/HnPN0pWy8Do6yhhqHAwcvRFGIws+QW xQIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YzRoQK48hdn26VwNICKcMxppEh6YmVkly2mV0TpEsRM=; b=KdDsrQXCGKrTW6foxBhiAPTAvyqdOWN9VyFZSdaQotbgcU26gstonyROKU3l+ZezHD pd0OUFSIKvKZc/Ru/GVy4pOEylKZeKlDc1TVCFN8ve/o5tkcJxHF+KFqBcm3Lx/SZ1PD BrUUJYHXlIXtF0DUHD3vPKV/O8UvQHsGm9xafjo/bk7Po8bDbtZmONWtao5b5AwxWi// 4ageHPcfiSsyoXsX/x+a5lWjh0ENow263kdRJ9rdFagC5muiLM4GG8NauFBwUygjcJZ7 euWi/5j3E4I5Jf7NRRKosn4dXmK4vozWgzDBY4tkaIghnI5fxoLXkJrX8/pORP+3q3ls 6KnA== X-Gm-Message-State: AOAM53056n0i/1WWsZuoz+6qc9efJ+D66NeqS5McsgIcAvbYtoGUbIVx NVyMKlKd5vQuibyacc6nc9iQCNBp/fbKchh4ZR4= X-Received: by 2002:a17:902:7144:b029:da:7268:d730 with SMTP id u4-20020a1709027144b02900da7268d730mr632304plm.20.1606788470247; Mon, 30 Nov 2020 18:07:50 -0800 (PST) MIME-Version: 1.0 References: <20201130104420.321531ec@coco.lan> <20201130180834.07a3116f@coco.lan> In-Reply-To: <20201130180834.07a3116f@coco.lan> From: VDRU VDRU Date: Mon, 30 Nov 2020 18:07:37 -0800 Message-ID: Subject: Re: [PATCH] media: gp8psk: initialize stats at power control logic To: Mauro Carvalho Chehab Cc: Willem de Bruijn , Linux Media Mailing List , linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , linux-kernel , syzbot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mauro, After many attempts ret was always 0. Please let me know if further testing is needed. Best regards, Derek On Mon, Nov 30, 2020 at 9:09 AM Mauro Carvalho Chehab wrote: > > Hi Derek, > > Em Mon, 30 Nov 2020 08:04:31 -0800 > VDRU VDRU escreveu: > > > I have hardware that uses this driver and can conduct a test if it > > will help resolve any confusion/assumption. I'd also like to suggest > > that making changes to drivers with no means of testing those changes > > is bad. This has happened in the past and resulted in unnecessarily > > breaking drivers for those who use it. No patch should be merged > > without testing! > > It helps a lot if you could test it. > > The current situation is that, if the I2C read fails, the > driver will randomly power up only partially, which could > cause issues. > > The original proposed approach: > > https://lore.kernel.org/linux-media/20190627222020.45909-1-willemdebruijn.kernel@gmail.com/ > > Will just give up trying to powering it up, while the > patch I'm proposing will force the device to power up > all parts of it. So, it seems safer than the original > one. > > Please test with the enclosed patch. It is basically > the same as the one I proposed, although this one will > print a message at dlog, due to this: > > pr_info("ret returned %d\n", ret); > > This could happen when the device got plugged and/or if > you put the machine into suspend mode, when resuming it > while streaming[1] > > Regards, > Mauro > > [1] not sure if dvb-usb supports it. One of the rationales > behind dvb-usb-v2 were to be able of properly do > suspend/resumes. > > > > diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c > index c07f46f5176e..be55496cc717 100644 > --- a/drivers/media/usb/dvb-usb/gp8psk.c > +++ b/drivers/media/usb/dvb-usb/gp8psk.c > @@ -182,11 +182,16 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) > > static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) > { > - u8 status, buf; > + u8 status = 0, buf; > + int ret; > int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); > > if (onoff) { > - gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1); > + ret = gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1); > + // Just to check if the condition happens in practice > + if (ret < 0) > + pr_info("ret returned %d\n", ret); > + > if (! (status & bm8pskStarted)) { /* started */ > if(gp_product_id == USB_PID_GENPIX_SKYWALKER_CW3K) > gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); >