Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp994290lqd; Thu, 25 Apr 2024 02:58:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXoD/ALPSzHY47ESi66oOFwZY2qz+EqLQWSWfqpvuKYgxRZnzhmMPbbA0HAFpiG5Y2EEJkHzOaACcsBk2JpVP90HdkAVfmzkglPRYilWA== X-Google-Smtp-Source: AGHT+IF6iATxL+n1ScXRdyJkMdr//KuejcAvWlG6nkiB3Yyws2MeOPN0xsqBJzfYpmx6MmrxTvkN X-Received: by 2002:a05:6214:c8b:b0:69b:60b6:7c5d with SMTP id r11-20020a0562140c8b00b0069b60b67c5dmr3153907qvr.18.1714039110735; Thu, 25 Apr 2024 02:58:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714039110; cv=pass; d=google.com; s=arc-20160816; b=ryX6giK+T8NirUp1SujraP+KWcWA7iHnrO/cOvRWYkwyYn2+BQunRUUkenY827MU/9 95C1ZAK+ePaEVmzYLqjTa0pK/FvHMQdU6zX+al2pqFccxF4gNNjVI5Ez+wKXDW96Bkt3 PBSPLFAolWEIFl9h2SZh2MOdj33XLolAdKFg7VY8GFjJiQtMhc66187v1shfcpvk0eVQ 8RDYaBBJFiNVygXU56cL5nWcju7ZTl3JZWCXZ03YqmDfC4kGvWdVbhbGTjKvLwO5ZsZC MNC++004RI6/nEtX0/3FCTe6P2R6xgemfn+AM0MmDNYXM8+Nlz70/Q7hVNWv/KyRw5J6 00Vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=4JVJJomIU4+zmhSquYMRwYEzBaS5AyUgJrKtGG8RrkI=; fh=+xMXiYvvyxWnylPpvGJGHxO5AdE0tqn17q7/q2XRASo=; b=JGOYNOWPXk8aSZls+DyNG239jn7WOc+K2CTxGLTpuiDgSibwajPJh2oO2s+yXLH5Xj Ymxoz/HdEPgXmIg62Gbm4wJ7XKlSpkZDLC4tRkukm2GmD2D3girZwC8YBRw94jw+rgTe bOwYtXknvMTieOiOtg5UnkM99aM5oVWVgTXFsFIgAl6PVcAuB889HHDMdN/DNOP/tc7o 0BQVehR7xVlRCLKq+y83cCJ+RDFmNhyuXznE1wnyuyZZokI2wfBhjj5wvlDmEY/muTJa 5M9lJFALSOqSSQzlrx8VxGZnRZwNNvOnGDCCqYEOJJQlwVSPWB3l3d8SPejrDACv4t1n /qQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-3846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 11-20020a0562140d6b00b0069b477ab103si17235255qvs.168.2024.04.25.02.58.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 02:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-3846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3846-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2E64F1C20CCA for ; Thu, 25 Apr 2024 09:58:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D70BE84FA2; Thu, 25 Apr 2024 09:58:26 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54F2682864 for ; Thu, 25 Apr 2024 09:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714039106; cv=none; b=qK48xTaZ62ksOwM1PqAxB5OIn+t8XAV+tNPUeNsxcdaIxaa1OWFM/0ElyFtWTjxzKm7a85sOUEAsJKRppXpyyScno6lxAV+7SneQd/DGa4LpJEZ39NjulRZzFtEzShOUNsZBuZr/y3/oOyF2oh6gx9vO3b5gWxubxcPzZ71GUXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714039106; c=relaxed/simple; bh=J5GvCNpllLEV9nzuDJavMIJX+Q1mfT07hoyNoeT6k6c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BTO1vsG70T2ptXrFi9eDvDV07R3OC7Fk//hJr1d9R4zAr5TiSxCBtSfUEM0FWL+FaxcaxPkN6S87sawpUZilhFUNZqT0F0UXVdbpyyqb2S+bqy8m5O4fj3oFEMW6OWtt/ZZYSddS2P8UhKphmruuev0H+lEbqgoe4o4wI1vfppU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=fail smtp.mailfrom=kernel.org; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org X-CSE-ConnectionGUID: OkCnHsToRPeNWzGNJPIo/Q== X-CSE-MsgGUID: xoFb9CbTQSWhfz6qDQu9xw== X-IronPort-AV: E=McAfee;i="6600,9927,11054"; a="9584018" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="9584018" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 02:58:25 -0700 X-CSE-ConnectionGUID: Cg4/5Cm3RVGi2RzuHv7fuQ== X-CSE-MsgGUID: 5oOkjPLhRiKjs3troc24TA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="25052602" Received: from smile.fi.intel.com ([10.237.72.54]) by fmviesa007.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 02:58:22 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rzvrv-00000000xJU-0yPK; Thu, 25 Apr 2024 12:58:19 +0300 Date: Thu, 25 Apr 2024 12:58:18 +0300 From: Andy Shevchenko To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Gregory CLEMENT , Arnd Bergmann , soc@kernel.org, arm@kernel.org, Hans de Goede , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Olivia Mackall , Herbert Xu , Greg Kroah-Hartman , linux-crypto@vger.kernel.org Subject: Re: [PATCH v7 6/9] platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG Message-ID: References: <20240424173809.7214-1-kabel@kernel.org> <20240424173809.7214-7-kabel@kernel.org> <20240424205123.5fc82a1a@dellmb> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Wed, Apr 24, 2024 at 10:47:11PM +0300, Andy Shevchenko wrote: > On Wed, Apr 24, 2024 at 08:51:23PM +0200, Marek Beh?n wrote: > > On Wed, 24 Apr 2024 21:33:44 +0300 > > Andy Shevchenko wrote: > > > On Wed, Apr 24, 2024 at 07:38:05PM +0200, Marek Beh?n wrote: ... > > > > +static void omnia_irq_mapping_drop(void *res) > > > > +{ > > > > + irq_dispose_mapping((unsigned int)(unsigned long)res); > > > > +} > > > > > > Leftover? > > > > What do you mean? I dropped the devm-helpers.h changes, now I do > > devm_add_action_or_reset() manually, with this function as the action. > > But why? ... > > > > + irq_idx = omnia_int_to_gpio_idx[__bf_shf(INT_TRNG)]; > > > > + irq = gpiod_to_irq(gpiochip_get_desc(&mcu->gc, irq_idx)); > > > > + if (irq < 0) > > > > + return dev_err_probe(dev, irq, "Cannot get TRNG IRQ\n"); > > > > > + err = devm_add_action_or_reset(dev, omnia_irq_mapping_drop, > > > > + (void *)(unsigned long)irq); > > > > + if (err) > > > > + return err; > > > > > > Are you sure it's correct now? > > > > Yes, why wouldn't it? > > For what purpose? I don't see drivers doing that. Are you expecting that > the same IRQ mapping will be reused for something else? Can you elaborate > how? (I can imagine one theoretical / weird case how to achieve that, > but impractical.) > > Besides above, this is asymmetrical call to gpiod_to_irq(). If we really care > about this, it should be provided by GPIO library. FWIW, gpiochip_irqchip_remove() disposes mappings for internally allocated IRQ domains. So with your code it even might be a double-disposal. -- With Best Regards, Andy Shevchenko