Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp982179iob; Fri, 13 May 2022 18:30:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGKD7bGu5L0UvcPq6faNt3/7f1gbaGCa5nuqf2HIuT1gIrQMcBm8nEfseqMPBbwzHQbGaD X-Received: by 2002:a05:6000:156a:b0:20c:64e3:948f with SMTP id 10-20020a056000156a00b0020c64e3948fmr5888416wrz.436.1652491851504; Fri, 13 May 2022 18:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652491851; cv=none; d=google.com; s=arc-20160816; b=zGpLIBZGvhyc6aSGqfZvgX4U0DBVe6rLR7KnUrJ4OeX+CPOBsUNAbKw3d+YkjKCyS5 i3ln5PzVPodvsixrOWVY3m4UpHuI46FMwQdoepb+Wy+488XGHYHKUlVyxrHny8PRthWO Ag9acJlHQLlqfj3s3uQAfKBc5z1FJnFT1m13QQAU+9xJJNWr52DBBxLxFI5j6tSK5Sia ZioZoAvussYpO1MdF2U1MWzMCfsvOl6dP3VquMrKw8UP3WQWOiAuyHOxUttawePYdWW3 jz9TG8Ka6rD0g5ilcnwmsdowcyJnVvsRVf3djgKV0r1wvIARWzc2nAClz09XPt/ikkXR Fd2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=MADkFwgg1XUplEuYx9uz64f2njl1lKYxMx1PFyW0nBI=; b=tyPTp6O29Dm99BiuuCwEWAaWNSISUbsBw3aXcW9ThvtZUAZCK14/EzH/EdXWG7knJN qJG8LAmBVoLx2xl2tomLFpT5iBPTnpO8Mrd/LvaG2pEDrBejyIdChJQVCY8Y9dW3uePS Aga6whST+wNNU2nGj7yGyd0GGXfGh7SFIpMJ0ngFjkV03dnaRofQoAo2XnuL219IHoH8 Iq2tjI9/1b8pR5XNLp/s6b2KbJXvq28fZSOd/MCoWJyCwKBrPg4n1Sp/09WdHvQX9Fnq 7aXfyHD02+jz55u/4qOFmzA3jihdZkMjQnKzYJy6Fh39OChBEvja8PulBj2mz4J9IOGU zG0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="eOK/l3Ws"; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=nxT5CZ3p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z17-20020adff1d1000000b002041389fb7bsi3382932wro.68.2022.05.13.18.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 18:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="eOK/l3Ws"; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=nxT5CZ3p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E394B3F9DE4; Fri, 13 May 2022 16:58:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359866AbiEMJcY (ORCPT + 99 others); Fri, 13 May 2022 05:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232052AbiEMJcT (ORCPT ); Fri, 13 May 2022 05:32:19 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504637A47D for ; Fri, 13 May 2022 02:32:18 -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=1652434338; x=1683970338; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=KH2BK9hE9xsWVSxn/PwrMINbgCNBQSZKrJA6qaX2eVA=; b=eOK/l3WsypKyZOT8wiuh69jmrs1fpTrfURVpCs9XfW2BI+mrDm6b4pQ6 tjYadsqYFieO0h0dFIXfXN/H48O8zX3x0jKtRBlpfJXIZ3sOuq2flFb0L FE8NPOPLj0HRV7K3q4l9j5deLjw2kNdKpW9huxeAuy0xl6PxMxomKFQwe JwWS3Lp8ZYtglN7MI5Ezjv78GFqxoNORWource60oYNoqKDE5AFRGlDGs WGGjw9L5MVTihNI31bU8LL5cegywW0F3UMRMBkh85G/cuPu9Sg2FyLtb7 gLFv2ziTgVEvzeJadbfw+er45mtRS+eFjpRAeJ0lid19ADHGvrI3Shiyb Q==; X-IronPort-AV: E=Sophos;i="5.91,221,1647273600"; d="scan'208";a="304473016" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 13 May 2022 17:32:16 +0800 IronPort-SDR: JfS5fipLNLHQRMavL4JEAiTCAzGGdtnLIHwiF5G64s9VuSbkEVPjNTtVuBfRXmDq0kxLapm7YT LcWFsGYUrzknTZBfNVJ17ayXmSZfKCGe7EWvJtDQ2XFbMU7yjSQx6bnqyZx0QGlPw9/9glGdjO hdbIM2sp/iDMxXgYctI6OS6YUpHLYy3wTGqV94e0+2/jRL272BDoT4jD/oujorGC7w5azG/TmH emCUL4U1NlKcgb3pSevwsJRsoulhKExS0gUKY/yyV7uD9KCkAnvatu2yJplNUzbwGyOFBON4Aw w4hzrF3FEepQt8iQzldvUJ2A Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 May 2022 01:58:12 -0700 IronPort-SDR: GNBZd+P4W75G9FS1neDhiaqYs0tGStF36V0qjTYUStE9PPY/ToQfbBr1RbpcunRLOAgbd5TQkr QlEboewOy2v1IKRi8d7W1uv2JSEmoabR+mx882+WF2Hv2EZh0JhJfKkZoRYsFL04KKsydDI2M+ 6YIAOF2h+UzojO/tZQn9VqC5dC6Pw8DslVGeBZ2e+8LvRZma6EDAQEOhgWe6r+MJUOvRTBnJu9 06aXWyKwa1UYXO6DvKlm7W2gqdTXtv0OBlFFAAMPjFQyUFNdLsv7MLaHztdjf+Qqvawfjon64v iqY= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 May 2022 02:32:16 -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 4L03MM58rRz1SVp4 for ; Fri, 13 May 2022 02:32:15 -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= 1652434334; x=1655026335; bh=KH2BK9hE9xsWVSxn/PwrMINbgCNBQSZKrJA 6qaX2eVA=; b=nxT5CZ3pULKILzz5et6S+/LrwhAJdTpkbWWCblYqPU/0rog6s5g FILpt7ojqXZzyxl0tHtYSXKPKqomckHQb9twd9C9qVY+lsCkLb62oUbLNJ1dkK88 FC1+Di4GcB9MYIxvxqPfVOH2GytwecE2ToN5TUlbX98URoTspIwknFLHQJ03xhPZ qRGMJRLAgDlApdiA4TstzfpvFyAc4U4g/rbp+GkR0kX4ytBG2IP7Rol0ZcVUcwZ8 ZYedN/SyIjr9zhqPD1swoKBw+2Gy4my+QVBWaFUqMh0QXRpP0dJL6IFe4vDNpiTa yo2ySNZ5jlNqbzadONoXgZ3Lb+FT0snMiHQ== 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 V3NbDLSCcS60 for ; Fri, 13 May 2022 02:32:14 -0700 (PDT) Received: from [10.225.1.43] (unknown [10.225.1.43]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4L03MJ0L9zz1Rvlc; Fri, 13 May 2022 02:32:11 -0700 (PDT) Message-ID: <83ae3312-36ea-fa01-9b53-28818a04699f@opensource.wdc.com> Date: Fri, 13 May 2022 11:32:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v3 08/23] ata: libahci_platform: Add function returning a clock-handle by id Content-Language: en-US To: Serge Semin , Hannes Reinecke Cc: Serge Semin , Hans de Goede , Jens Axboe , Alexey Malahov , Pavel Parkhomenko , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20220511231810.4928-1-Sergey.Semin@baikalelectronics.ru> <20220511231810.4928-9-Sergey.Semin@baikalelectronics.ru> <0732a28c-579e-52f8-21ad-653fd9a10aa2@suse.de> <20220512142607.u2kls35pevnjsjjh@mobilestation> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220512142607.u2kls35pevnjsjjh@mobilestation> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/05/12 16:26, Serge Semin wrote: > On Thu, May 12, 2022 at 08:32:37AM +0200, Hannes Reinecke wrote: >> On 5/12/22 01:17, Serge Semin wrote: >>> Since all the clocks are retrieved by the method >>> ahci_platform_get_resources() there is no need for the LLD (glue) dri= vers >>> 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 b= e >>> found. Otherwise the function will return NULL. Thus the glue-drivers >>> won't need to either manually touching the hpriv->clks array or calli= ng >>> clk_get()-friends. The AHCI platform drivers will be able to use the = new >>> function right after the ahci_platform_get_resources() method invocat= ion >>> and up to the device removal. >>> >>> Signed-off-by: Serge Semin >>> >>> --- >>> >>> Changelog v2: >>> - Fix some grammar mistakes in the method description. >>> --- >>> 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_pla= tform.c >>> index 3cff86c225fd..7ff6626fd569 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_p= riv *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 a pointer to the clock descriptor of the cl= ock with >>> + * the passed ID. >>> + * >>> + * RETURNS: >>> + * Pointer to the clock descriptor on success otherwise NULL >>> + */ >>> +struct clk *ahci_platform_find_clk(struct ahci_host_priv *hpriv, con= st char *con_id) >>> +{ >>> + struct clk *clk =3D NULL; >>> + int i; >>> + >>> + for (i =3D 0; i < hpriv->n_clks; i++) { >>> + if (!strcmp(hpriv->clks[i].id, con_id)) { >>> + clk =3D 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_platf= orm.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); >>> 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); >> >=20 >> Where is this function being used? >=20 > It will be used in the DWC AHCI SATA driver and can be utilized in the > rest of the drivers to simplify the available clocks access. > BTW Damien asked the same question in v1. My response was the same. Please squash this patch together with the patch introducing the first us= e of this function. >=20 > -Sergey >=20 >> >> Cheers, >> >> Hannes >> --=20 >> Dr. Hannes Reinecke Kernel Storage Architect >> hare@suse.de +49 911 74053 688 >> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnbe= rg >> HRB 36809 (AG N=C3=BCrnberg), GF: Felix Imend=C3=B6rffer --=20 Damien Le Moal Western Digital Research