Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1070165rwe; Thu, 1 Sep 2022 12:01:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR7n4Jvfeu/T+f+oqQGVo7OozW+IWExDxgPLVDvqLS31F8rKpK6V3GOBu740CY1hnCNDfJ9f X-Received: by 2002:a17:906:cc5d:b0:73d:c534:1aaa with SMTP id mm29-20020a170906cc5d00b0073dc5341aaamr24433830ejb.626.1662058891270; Thu, 01 Sep 2022 12:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662058891; cv=none; d=google.com; s=arc-20160816; b=L0V1Q/hHtqB188UAkNOs4j8cPtN3nUiI9f5e0HYPuD9FXpV34j7dHhnzpOAMTN3Ani KXNUk5z/alhIfoHolDt0mi5ViWSkK9TfVxOChGCZFSgzTB1X9QEnjvq7tefRVbJEovns kM/8CT51GjjAm8a74Qz5Rm0OUpCqVwDxBFd1P/jgYJ+RhYXHabu3RaZxbOneQNqEdYDC FWJurWxdRAIyRdyU3/1+rvHXtkW8uahpqmDpXKThg+s02MiEH+nRy/znSZRlUomAvfl3 hvrkhKRimpiNNB4budc11N1JCoD0dQj5sO7sJ8XC+Yg2TAchrF1JDK7FrOsYv/M+N9Mt Zy9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=q7BH3O66CKCqnf3ocrNMj0tQgjMLRxIP+6Cu1HPsydc=; b=U6i3uB5r32FyMZmV3UjyMhVfHFeoWUWXd6STmm7qQev2JydOh7zfcu8J+lTshe0EBU NPickM2xsmGRty/LVYBLJHsiOEK2iQKjwfhNdhto/Y/ZYX4+DiAULi0qMQDhjRx5e76d XzmpzRxVrETkbMf3IDyokvL6PsT0EtSn4K4iN5y/PoB+2yS5H9MGaA9h5ypvAN11NmuQ 7PyA8xBXxedN1axm8AkAIlQEQ4TrnEl9EMoDWx1vSAjShx13sfIVzEbMYPJJId8stp91 UCdgW72xSon/hMP8T+hUFC39gmEp5v56+edLAmpo1PMY9VJkDOUb2sVpapzg6UdrI+dm JgZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cLnQGwP/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020a056402348700b004485cce26d6si2647369edc.190.2022.09.01.12.00.40; Thu, 01 Sep 2022 12:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cLnQGwP/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234784AbiIASh2 (ORCPT + 99 others); Thu, 1 Sep 2022 14:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234693AbiIASg7 (ORCPT ); Thu, 1 Sep 2022 14:36:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F7F920190 for ; Thu, 1 Sep 2022 11:36:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 56F1661CF7 for ; Thu, 1 Sep 2022 18:36:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E538C433C1; Thu, 1 Sep 2022 18:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662057366; bh=Y/mO+qRCMrK0idcc254YXG8TJylthMPW6zBfv4IQves=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cLnQGwP/0DENf2zZ79Ge/zMKw5j8Lnv8OnJayM7BMzFac5qxleNiZuzrAzzXYqdh+ HTXRzfcJnkO+CIyy/QPdXMsorwS85AtvaWYO/6S43WnwJ6r3XwqrGm4mXAYurJX/Wi 1rmHorJlig9l+4vl/y8Hji+eaKRrXv0kr+saHSKvSskJYAuXL1FOKqoWXeu25NxPX+ wmIWAAbtzjS/vg5ZISrXYyJG7UHiecX+WHkIUPWP5f9jAmIDQn+gdWG/zAFiRoLoe3 FBRNPjw81Y2E/7ElZN4GwPM+jepGdbmiIGTChlaXeHgtQ7R7nPSb7V/pDeO3bWzCoQ Gf13MF2V8b8DQ== Date: Thu, 1 Sep 2022 19:36:01 +0100 From: Mark Brown To: Jiho Chu Cc: gregkh@linuxfoundation.org, arnd@arndb.de, linux-kernel@vger.kernel.org, yelini.jeong@samsung.com, myungjoo.ham@samsung.com Subject: Re: [PATCH 1/9] trinity: Add base driver Message-ID: References: <20220725065308.2457024-1-jiho.chu@samsung.com> <20220725065308.2457024-2-jiho.chu@samsung.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9lpWXlZqwrEMGTTR" Content-Disposition: inline In-Reply-To: <20220725065308.2457024-2-jiho.chu@samsung.com> X-Cookie: Information is the inverse of entropy. X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 --9lpWXlZqwrEMGTTR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 25, 2022 at 03:53:00PM +0900, Jiho Chu wrote: > + drv->opened = drv->opened - 1; > + if (drv->opened == 0) { > + /* wait already submitted requests */ > + if (drv->desc->drain_reqs) > + drv->desc->drain_reqs(drv); > + drv->desc->set_state(drv, TRINITY_STATE_PAUSE); > + mutex_lock(&drv->lock); > + /** remove PAUSE set on the CP of the NPU */ > + if (drv->opened == 0) { > + ret = trinity_wait_ready(drv); > + if (ret != 0) > + goto out; > + } > + drv->opened = drv->opened + 1; Would it perhaps be cleaner to hold a runtime PM reference on the device for each file and deal with the power up/down of the hardware in the runtime PM callbacks? --9lpWXlZqwrEMGTTR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmMQ+5AACgkQJNaLcl1U h9BlHgf9EFnETk9uty/p+c7YsUZXO8zTfgSmK4Ckc+tItNAEHdUVnq1v5qIqjFmq vAM4wfGeIV9NnmxjTGmAu9t4OP0pVZkSb4uTV89Y+fXuti5XuB6OJuT3Smqham+g DXRB/oV+Bs1qqnrEJN3cMJc9IZal66VCSeFDq2zcLxJk5xTv9NDlaHXL27/nxvLt YykqEOaitb1lJ0aw9Uyo/NDMzy5BJMZXlAZQgfKXd7s65PMs0GxZWhiVceYwavXe lulmAQzZplm5mVFW/QgN/nLtllLAZdsuV2YlshL60nTg7b+pPQsaiycPOqF7Wpmr mzlyK3kOfbmJ3HDT347rp57G91grHg== =edp6 -----END PGP SIGNATURE----- --9lpWXlZqwrEMGTTR--