From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754023AbcKUQvc (ORCPT ); Mon, 21 Nov 2016 11:51:32 -0500 Received: from vern.gendns.com ([206.190.152.46]:52685 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752859AbcKUQvb (ORCPT ); Mon, 21 Nov 2016 11:51:31 -0500 Subject: Re: [v5,3/5] USB: ohci: da8xx: Allow a regulator to handle VBUS To: Axel Haslam References: <20161114144103.12120-4-ahaslam@baylibre.com> <26d7b4c1-a7ef-7250-eb6a-270182d279ea@lechnology.com> Cc: Greg KH , Alan Stern , Kevin Hilman , kishon@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: David Lechner Message-ID: <43bd46ae-cf13-a5c2-6483-ba759cdc9b3c@lechnology.com> Date: Mon, 21 Nov 2016 10:29:14 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/2016 04:22 AM, Axel Haslam wrote: > Hi David, > > Thanks for the review, > You're welcome. >>> >>> @@ -160,15 +212,41 @@ static void ohci_da8xx_ocic_handler(struct >>> da8xx_ohci_root_hub *hub, >>> hub->set_power(port, 0); >>> } >>> >>> +static int ohci_da8xx_regulator_event(struct notifier_block *nb, >>> + unsigned long event, void *data) >>> +{ >>> + struct da8xx_ohci_hcd *da8xx_ohci = >>> + container_of(nb, struct da8xx_ohci_hcd, >>> nb); >>> + struct device *dev = da8xx_ohci->hcd->self.controller; >>> + >>> + if (event & REGULATOR_EVENT_OVER_CURRENT) { >>> + dev_warn(dev, "over current event\n"); >> >> >> Won't this result in duplicate overcurrent warnings in the kernel log? It >> seems like in previous version of this patch series, we would get an >> overcurrent error from the core usb driver. > > you mean in the regulator driver? i did not make changes to core usb. > but, no, i did not add a print in the fixed regulator driver itself. Since > the regulator is a separate driver, and could be implemented with or without > a trace, i think its better to leave this print. It shows that the usb driver > has well received the notification. > No, I mean in drivers/usb/core/hub.c. There is if (status & USB_PORT_STAT_OVERCURRENT) dev_err(&port_dev->dev, "over-current condition\n"); and if (status & HUB_STATUS_OVERCURRENT) dev_err(hub_dev, "over-current condition\n"); In ohci_da8xx_hub_control(), we are setting RH_PS_POCI and RH_PS_OCIC, so these messages will be printed via the core hub driver. We don't need to print another message from the same event.