From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 271F6C433F5 for ; Thu, 24 Mar 2022 01:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234004AbiCXBhn (ORCPT ); Wed, 23 Mar 2022 21:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiCXBhl (ORCPT ); Wed, 23 Mar 2022 21:37:41 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D2FD92D25 for ; Wed, 23 Mar 2022 18:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1648085769; x=1679621769; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=gsAck33gFP7RxtLhhR89Z8++2bilhvSOMcQfDm+nq8c=; b=ToxXI28gFr6tO/+6qFePuwoRyCsjOS1jHPuCJLdiskUaqlOvSVRBL3v4 n+fxICqB7QLEdgvQS4sD7VXEWmfTS7BJZ8rrCVp/ppSJ+JzBeM4J79Srr 12IEFYUw1C5YqpmRL9fAwAFv+qG6wHLShztcC4PDTSonYNDW2F1uHvNi3 AO9hrtwZtahU9lZ6MQHfHVBZk6bQ8vS6twnU3fUjHDEOLPr3Y+o2ytH64 rZYoQODYXJgtw3iiqQRCRKRAHAiuRx1dRvTUPJW2L1Rj1S9gZc7nAlz/9 9UMIBmnLTnTs7I91g/Fcqbqlh+uJX3ujLmGGydv7lSme36ecxVfsf/yyh g==; X-IronPort-AV: E=Sophos;i="5.90,205,1643644800"; d="scan'208";a="195019572" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Mar 2022 09:36:08 +0800 IronPort-SDR: NaTpSS6yd980wBZVbIYF9TFORuyxqJA3sw53NrwPdoBuUoyOLQ7yT2/WN4kqb4W99gyHqzSOZa zQB6fS2piQiqKIn2WFMuYkv5TglR0b+VbuewRLmanArfu/C0K9QKIFU/TeufV28lb0eaYfTyzZ Jr0lQRyHiMZvWcvWOZSHvrzcZZa6CLqHzN6jMSacPuiuJPjkQi+c8dhtqbDUwOZcXXEq+Po0QD 52cFk926jdpNqh+4c5c23hfpxEOlEyfTn/3w/sykBnOr8vT3yMF/EpOGyNoDwWp5L1px74SYcQ EXKAJYyvSyjvzDvn3yU6fZoe Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 18:07:05 -0700 IronPort-SDR: oyMjlRM8ZfMlQFlmlBg2bqP5a9/TTppfVX+hWNeP4zwFT6clxvTIyUJHDYfMHs6C7DmA48KtTl BKgiaBZRCUyQpZqe9xUAwjGBy40FPtV10yMEgLm+P5SREflxVZDskAXGf5w3/95H1Qimfypvj+ C+32xf+8bp5UQR9em6reWpx3bMndy0booNHHiNsHkJHJU4Dxazm5YId/TFQv5K++Hen1lE0bgr Okc4DTiIYhgAnyBNrQLuRJOiNyN/eUwpUMROIFt0ip6XZ7DqUFYlmAJboigOSu5XpntmUfbrM/ Vio= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 18:36:09 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KP79407Kgz1SHwl for ; Wed, 23 Mar 2022 18:36:07 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1648085767; x=1650677768; bh=gsAck33gFP7RxtLhhR89Z8++2bilhvSOMcQ fDm+nq8c=; b=k1Rwmz/bIjpWeV8Jh9O+EbBMvmLx9z7xfmIXdZERzPVelBEkNcu suPyirWqQUEQCdXl1NZc7HD1Eq+ByEt4xdFv12VJEfRbaSQ/sZnUK7YTWf9HbZOs /jf7VwHNqAI31TRUOfa2aivNHcnh6BKKiVGrB85Vs58zeinbV1s3P0fSz3UBcuSj b2NutWJjlUr5XdEoC3k8r1jpi4bhwDu3oz9T+kSKRQzV1MNJV3v73MyIJ0IQSqkM 9Pf1dRiu656y/WTLviLM9AfrqZT1hVNpeBtJaNaWYcpFpqoHXBuGVtUAp7tVRLpp AGWVWHTRES83kA/3APp8w3RlRN9LVCjLWJw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FDyhL1GxeveJ for ; Wed, 23 Mar 2022 18:36:07 -0700 (PDT) Received: from [10.225.163.114] (unknown [10.225.163.114]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KP7916Yjlz1Rvlx; Wed, 23 Mar 2022 18:36:05 -0700 (PDT) Message-ID: Date: Thu, 24 Mar 2022 10:36:04 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH 06/21] ata: libahci_platform: Add function returning a clock-handle by id Content-Language: en-US To: Serge Semin , Hans de Goede , Jens Axboe Cc: Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20220324001628.13028-1-Sergey.Semin@baikalelectronics.ru> <20220324001628.13028-7-Sergey.Semin@baikalelectronics.ru> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220324001628.13028-7-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 3/24/22 09:16, Serge Semin wrote: > Since all the clocks are retrieved by the method > ahci_platform_get_resources() there is no need for the glue-drivers to be > looking for some particular of them in the kernel clocks table again. > Instead we suggest to add a simple method returning a device-specific > clock with passed connection ID if it is managed to be found. Otherwise > the function will return NULL. Thus the glue-drivers won't need to either "glue-drivers" is really unclear. What do you mean ? > manually touching the hpriv->clks array or calling clk_get()-friends. The > AHCI platform drivers will be able to use the new function right after the > ahci_platform_get_resources() method invocation and up to the device > removal. > > Signed-off-by: Serge Semin > --- > drivers/ata/libahci_platform.c | 27 +++++++++++++++++++++++++++ > include/linux/ahci_platform.h | 3 +++ > 2 files changed, 30 insertions(+) > > diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c > index d805ddc3a024..4fb9629c03ab 100644 > --- a/drivers/ata/libahci_platform.c > +++ b/drivers/ata/libahci_platform.c > @@ -94,6 +94,33 @@ void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) > } > EXPORT_SYMBOL_GPL(ahci_platform_disable_phys); > > +/** > + * ahci_platform_find_clk - Find platform clock > + * @hpriv: host private area to store config values > + * @con_id: clock connection ID > + * > + * This function returns point to the clock descriptor of the clock with > + * passed ID. > + * > + * RETURNS: > + * Pointer to the clock descriptor on success otherwise NULL > + */ > +struct clk *ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id) > +{ > + struct clk *clk = NULL; > + int i; > + > + for (i = 0; i < hpriv->n_clks; i++) { > + if (!strcmp(hpriv->clks[i].id, con_id)) { > + clk = hpriv->clks[i].clk; > + break; > + } > + } > + > + return clk; > +} > +EXPORT_SYMBOL_GPL(ahci_platform_find_clk); > + > /** > * ahci_platform_enable_clks - Enable platform clocks > * @hpriv: host private area to store config values > diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h > index 49e5383d4222..fd964e6a68d6 100644 > --- a/include/linux/ahci_platform.h > +++ b/include/linux/ahci_platform.h > @@ -13,6 +13,7 @@ > > #include > > +struct clk; > struct device; > struct ata_port_info; > struct ahci_host_priv; > @@ -21,6 +22,8 @@ struct scsi_host_template; > > int ahci_platform_enable_phys(struct ahci_host_priv *hpriv); > void ahci_platform_disable_phys(struct ahci_host_priv *hpriv); > +struct clk * > +ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id); No users for this function ? > int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); > void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); > int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); -- Damien Le Moal Western Digital Research