From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754694AbbLPLYk (ORCPT ); Wed, 16 Dec 2015 06:24:40 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:42586 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754588AbbLPLYi convert rfc822-to-8bit (ORCPT ); Wed, 16 Dec 2015 06:24:38 -0500 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Sergei Shtylyov Cc: Tejun Heo , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: Re: [PATCH 2/3] ata: sata_dwc_460ex: add phy support References: <1450221935-6034-1-git-send-email-mans@mansr.com> <1450221935-6034-2-git-send-email-mans@mansr.com> <56714778.4070100@cogentembedded.com> Date: Wed, 16 Dec 2015 11:24:29 +0000 In-Reply-To: <56714778.4070100@cogentembedded.com> (Sergei Shtylyov's message of "Wed, 16 Dec 2015 14:14:00 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sergei Shtylyov writes: > Hello. > > On 12/16/2015 2:25 AM, Mans Rullgard wrote: > >> This adds support for powering on an optional PHY when activating the >> device. >> >> Signed-off-by: Mans Rullgard > [...] >> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c >> index 9985749..d07aae1 100644 >> --- a/drivers/ata/sata_dwc_460ex.c >> +++ b/drivers/ata/sata_dwc_460ex.c > [...] >> @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device *ofdev) >> } >> #endif >> >> + hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); >> + if (IS_ERR(hsdev->phy)) { >> + err = PTR_ERR(hsdev->phy); >> + hsdev->phy = NULL; >> + goto error_out; >> + } >> + >> + err = phy_init(hsdev->phy); >> + if (err) >> + goto error_out; > > If phy_init() fails, do we really need to call phy_exit()? No, but it doesn't hurt either, and it makes the code slightly simpler. I can change it though. >> + >> + err = phy_power_on(hsdev->phy); >> + if (err) >> + goto error_out; >> + >> /* >> * Now, register with libATA core, this will also initiate the >> * device discovery process, invoking our port_start() handler & >> @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) >> return 0; >> >> error_out: >> + phy_exit(hsdev->phy); >> iounmap(base); >> return err; >> } > [...] > > MBR, Sergei > -- Måns Rullgård