Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1000354iob; Fri, 13 May 2022 19:10:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV7OPtS0AboJbX1evfSgrR3DZW1pnhi4rYSEA1Vz/PywNnqOGAEgCrSzoA93g5qEDFjVLl X-Received: by 2002:a1c:19c3:0:b0:392:9cef:e32b with SMTP id 186-20020a1c19c3000000b003929cefe32bmr6874550wmz.116.1652494216027; Fri, 13 May 2022 19:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652494216; cv=none; d=google.com; s=arc-20160816; b=mEsQ3tqZK3OzQU11I9mxioxhAbS2HSwJ7vaujPiLbVmzuDB1hW71ymmQO8bg/LOAP7 6QLQVu4q27SuJ6xUwFs6BpVDj9H6ayoThOPKB+khp5JQvYM8VDtfmdd77WwCKf7ckF9W S1KcwU3WfRF3hTtF3v4Q3Ork9FcAtjtd8SaQT1yvfQnxhXsuoA5x2884c3Ak0lOxyEn1 kxIOoD47tFDId5tNK+cRmMb37zLfUNRgJLEiNXgh3RuMeElxQ/neP38FMmnxKKg/MNnc hL6sBb/hWrySPDAjDU7Pb9X/5xMpS6P59yyw+bMO4pkZr3+M6YaIPOlF5O542AzKPG0G cEPw== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=D1dnGRodwZfQvAzAQyphqZSe/zqVMsDCqlcuW+HAnWk=; b=Uf4nzY4cBeX2LviEyFwMh0mTRYtVYULrkTwR3G6mut/UW9bi60tJ1UAR89legD6ZAf 033E8ky1UtqhV07S1cyaqecxSJXoam2Bq17alSjvHLdMMJlChdf4VAIDmByJVcha8cM2 Qkcib8hEjedZrsmMnv0TdI0aqkjmSTSCgSa+96iI/i6jzujSE93y+YmQiR27a3wZv+Oe mEv1Dv2VoE3wgNq+vqh6KtFP5jEb2uH4P6BabNK8buveF4EvDr5sslHUzLizMbyyfzOw KXsIlx0WNKWY+eq4iTkfoALqDEKCFj55y2VzJAvVnoaiyVgFfzATS8WNs8rl37dA/GRj Tj2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=x8L5kNHi; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=fldwxa8p; 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=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i11-20020a0560001acb00b002041ca7b788si4833812wry.690.2022.05.13.19.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:10:16 -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=pass header.i=@suse.de header.s=susede2_rsa header.b=x8L5kNHi; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=fldwxa8p; 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=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D5693029C6; Fri, 13 May 2022 17:29:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350263AbiELGcn (ORCPT + 99 others); Thu, 12 May 2022 02:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343684AbiELGck (ORCPT ); Thu, 12 May 2022 02:32:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51CDE2B265; Wed, 11 May 2022 23:32:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 10CF81F8F4; Thu, 12 May 2022 06:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652337158; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D1dnGRodwZfQvAzAQyphqZSe/zqVMsDCqlcuW+HAnWk=; b=x8L5kNHi+f3EH7tGI41yh0aG4m6uxELC+cJz1wfF9AKrje+b/4nY6OoVwe8Kgag5F22EUc GVuNOIPgvnMDF5DUIpgXAUzSJckwGu5q3OrDUQWrG+wxp336lxpD0eB10z9QNsOJ6eTZQ+ kwtFIjRXUVjhEb4tFSxqwbhBWwyfSWM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652337158; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D1dnGRodwZfQvAzAQyphqZSe/zqVMsDCqlcuW+HAnWk=; b=fldwxa8pn+j2CO04dAvZ+AhIi1++2POneQnfDum8X5iY7F5IfacSKuE8k89SU491ptpXZ2 c+7LLCdiYoX9xyCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D5C2713ABE; Thu, 12 May 2022 06:32:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0QnfMwWqfGJDUAAAMHmgww (envelope-from ); Thu, 12 May 2022 06:32:37 +0000 Message-ID: <0732a28c-579e-52f8-21ad-653fd9a10aa2@suse.de> Date: Thu, 12 May 2022 08:32:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.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 , Damien Le Moal , 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: <20220511231810.4928-1-Sergey.Semin@baikalelectronics.ru> <20220511231810.4928-9-Sergey.Semin@baikalelectronics.ru> From: Hannes Reinecke In-Reply-To: <20220511231810.4928-9-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 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) 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 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 > > --- > > 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_platform.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_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 a pointer to the clock descriptor of the clock 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, 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); > 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); Where is this function being used? Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer