Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp571391rdh; Tue, 19 Dec 2023 07:20:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUewGNn0yYULTN5loWiliM6XIUoN4a1i+pe3SHEnpJheGLnIAotlKC37HlJj28tKhiwbfM X-Received: by 2002:a05:6a20:7f97:b0:191:8955:ce4c with SMTP id d23-20020a056a207f9700b001918955ce4cmr1644791pzj.60.1702999245869; Tue, 19 Dec 2023 07:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702999245; cv=none; d=google.com; s=arc-20160816; b=bOJ2yCHYSxkrM3do0Pt5iB1RwdPXdLJ8iZE+JRziBxV0zp2zfOF+5Sin+toDUUp48e pj1/f5Mm+SCL6bt/yrhSwPrmDdfTkjlmr5j7uuP49YhBQ0pRKu/Ho1AuTvVbSDblsSEL 4UqKwB2uH0Jzw64le6tii0MXettDxPtVtINbssjLhGx6YESyuRkTn08suyFaTU+AriV7 YCdRj/FDdA+bXkDTWdDDP1mjUssnA7MKnMMymxEZQbJ7JhPtUQGJp9XFfYC1AnB04NKr SZ9qeUbWh+PbJhDVh3sbvALS2ZokDUjM8ZA8RiFP+LAdMsUyLBN5Jn/JiJoihrwRFkcd NI/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=0OqwsWYSe5P1gROTWqF3GlsTx6nLwTPIphPoIkuP0IA=; fh=TFQI+YzLUQlYl4kOcmLiE6H8IBxzIqYzJVz8pYCx9C4=; b=cOhISoaT7tkXPgcisZN+l2tpGkLMyR7XTsr1zjKdlwGgPw2Mh4h5DZF8vKSCQ6l4eK XB6nTsMiVF2rQ9F4O/QZiXG/Baw8jl4sX96hSxpDQ36ZDuGLSLn72ttqcaJPCvdTR00y U+yr5Vfh4GZwkdmozHn5pAmUmKWOR5loJXLruHbtwNbox6b+GnpmvGMl+ZfrSW0Nq4dr zbYUycD3yfPXstdrgeORgz09u9U1E2rup7WHxDWotCK4uGPFHPOuDnmDY+IE9ecXfXma fBhvk1cFTIR88Bgf+wREWzkY405ctizHlLMMIsO5Jlj+IHhqgzcoOvcTDhedNKKtvjeu DpYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NIkGZftw; spf=pass (google.com: domain of linux-kernel+bounces-5459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ko19-20020a056a00461300b006ce83264887si14193350pfb.57.2023.12.19.07.20.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 07:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NIkGZftw; spf=pass (google.com: domain of linux-kernel+bounces-5459-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 035A72835DE for ; Tue, 19 Dec 2023 15:12:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6A211C697; Tue, 19 Dec 2023 15:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NIkGZftw" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (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 C31CA1CF86; Tue, 19 Dec 2023 15:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702998719; x=1734534719; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+xlnfKcJqebKZFuV6jH/QlOiaHFOq5igRUWnHrLzm+U=; b=NIkGZftwLirVlqp0o2yFyWhIyGIMeJEEoLJOpJ+A3vUzqewi+bldG+U+ 11yAIZR0yu/B6sKQeFfIvOlBwbL98szYQnoomk5Hp31Crxszegkxhblgi tqX1lAkxsxoqf+ijGPUYY+vzLjzpyv4Ov5uPK1r5v5n151EdBiOZSa2vJ ugY/CeP5QBibfHuRAIE17yAzZNlDpBon8vzN1B2X7N4MnUM3B7wti7Zzt YxJlpTujECRoHFVnEemU/Smq14iyYcLBy8JDjW+tct9qyQls8ULcwGHPR r9xI5WlaE+1JL7UK/pHFROS+5PHi+7YWqDn03biWCFPRZ6vTR4moqYQ/n g==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="460014993" X-IronPort-AV: E=Sophos;i="6.04,288,1695711600"; d="scan'208";a="460014993" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 07:11:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="866669664" X-IronPort-AV: E=Sophos;i="6.04,288,1695711600"; d="scan'208";a="866669664" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 07:11:57 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rFblC-00000007IDy-3Oqf; Tue, 19 Dec 2023 17:11:54 +0200 Date: Tue, 19 Dec 2023 17:11:54 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Kent Gibson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH] gpiolib: use __counted_by() for GPIO descriptors Message-ID: References: <20231219125706.23284-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231219125706.23284-1-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Dec 19, 2023 at 01:57:06PM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Pull the array of GPIO descriptors into struct gpio_device as a flexible > array and use __counted_by() to control its size. How big is the struct gpio_device? Unifying like this might provoke subtle errors on very fragmented memory, where k*alloc() might not find enough free space. Note, k*alloc() guarantees finding only memory for a single page. With PAGE_SIZE = 4k, this might be an issue. I would suggest, if nothing prevents us from switching, to use kvmalloc(). -- With Best Regards, Andy Shevchenko