From patchwork Thu Feb 8 18:47:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp501334dyd; Thu, 8 Feb 2024 14:58:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5wxR7gNIHLa26hFa6Yg3UI6osiqzfjq1Y7VV2GQCUDHYsn606gWm058wLqDMu6ikcQz3b X-Received: by 2002:a17:902:6e10:b0:1d7:310e:1e0d with SMTP id u16-20020a1709026e1000b001d7310e1e0dmr595734plk.32.1707433139643; Thu, 08 Feb 2024 14:58:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707433139; cv=pass; d=google.com; s=arc-20160816; b=zBsqwN1VK8VifbSZfteazHx4y3nV264W1DubKoM3ieC8ijDk4w8/00EcLUCEyr/tOx v7qL312BT5b7qwZ33ujWA3LaSfKrDJSNB8X72vKuBB6ymKdsdNyfPEU2rmT8+U1ZrAYy BctX5BrkumjC73Y6z5jWLj9TjJTPpfuog0dhlSLmncga83ecdXPrWMQaiXn+nh5Vok8v PP3gs+IbJ/HnHQCHpWeHGKss4GJzU45ggomgF8ZC9tNJSo0Te6qURcrY0OEDzrEjj7qa Vw5sz0YPeuNJ5xmsTdZidne60zkAj4yyuEhKM/xyx6PTKw5LvLdv4FQ2pT5aJf5DnneT kI/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Y1OxZfwbBEdkQNduZ+UqsCtkUK0BuohR4E0Vvham6lo=; fh=WQOPHf3HleD12ESXhrMmxxxsBgrq4ua1N6HPEwbHVkY=; b=IVWc799yWY70h193QbHccLhF3QL+EBCP/5dJgCwccxq0OvNRp8k9Sh2IU4jxUDe+VT alr3nNHE0TsAslZwPcxJD4R5Dgk5O7PRMM+y21/dzt0TmoSQrPiqX/rnbm/gbzWe4XD2 +aT/nQthmDu9PAj+txGcGJUbr957S9Skih96Wkk43w9Urfqja05vK1oTBRk0PvEDuKY3 rmUtpC8SnG2A8wSCGnD7d7ZGAMsbiuneDU9l7LDxIsiiJvm+7stpc/WPLj3WA7J380IB zXWsQBRq5SAIcPSBIJNPpMwGK2WCWhPt3BiwMyLU9lCnbm+HAuzvYruu/YSMfzedZLuX TPvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I17fLeB4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58558-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58558-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCX7EnS+UGtLVt6P8dgjaN+y7M2s/yyMveNcQR49rSXhA6wilnve/QG03pvzuhegVl1hk3qTGbjv27S2GWZR+fNDoO0jxg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c5-20020a170902c1c500b001d9bd7d3c97si453538plc.613.2024.02.08.14.58.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:58:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58558-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I17fLeB4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58558-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58558-ouuuleilei=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 55F4028FC3A for ; Thu, 8 Feb 2024 18:49:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0037028DBC; Thu, 8 Feb 2024 18:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I17fLeB4" 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 94C6020312; Thu, 8 Feb 2024 18:49: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=1707418167; cv=none; b=F+Sh6BKYu4owIl6z84ddJavJrfMrWgDiB71ijSfyJjIktUOP2njNiafbhUDZmL3b6yA7WaX9MptlqVsHMX5cGHRCjLZFQqFx30QL89CaRrgBnoxAzFqyhZ40nzvgvLlOjZt4hWNzWNWQhigbxWmvn9h7Rbf75K9M67BBzZqNCb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418167; c=relaxed/simple; bh=x8TByPmOrQ+gMAIIaoMyZZvfiNw4po8E/dT9novu62c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cps6cT+J0K/wvETvWfr04MugUYI9gHN9EdraRFydl8HKg7edAztRbODVjena8Rv1o6k6w9jEHPxShnEmC2e1Df9iAMPXp9vR8PtNui1Ozm1iDr5okN9jmOlqDb9G8qYieWsccWueCxGp1RLqBLQyzCTAC7z+9jFoHRCUaAuFUPA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=I17fLeB4; arc=none smtp.client-ip=192.198.163.19 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=1707418166; x=1738954166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x8TByPmOrQ+gMAIIaoMyZZvfiNw4po8E/dT9novu62c=; b=I17fLeB4i0dgIctRhUkJ8acOI7nGvMioLkitbYgIJIR+njz8J79cchtW IEDMhF2NeQBsyIFCi+5nY43bHStTBuR8PGyZE7won5aqb8ROn4sc+rsGi 3d2kCEAvbdN8rIPPZC4/O3O6OcYi53ZXXDSWWyu1SeN0d7Z+aSUgMRsFT O7cNMaLf9n/Qd0yzJh6on7Y8yBvODDo9IhZD6zKRdb/ToqtHRgLF4ymE1 siGtMM5ZsA5+aUCfGT+bGu+5hHQXS82f1sKPbEEogbVJG9j+KfWRQv7IZ uTEbkgUDtyhJTgCMMdAS8ycTSzp5L67yPwRWI0rmXN9HqoLIGEggCHQcJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186079" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186079" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215511" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215511" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 37A626B; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 01/15] auxdisplay: img-ascii-lcd: Make container_of() no-op for struct linedisp Date: Thu, 8 Feb 2024 20:47:59 +0200 Message-ID: <20240208184919.2224986-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790373411819674044 X-GMAIL-MSGID: 1790373411819674044 Move embedded struct linedisp member to make container_of() no-op. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/img-ascii-lcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c index 56efda0740fb..09014ada38bd 100644 --- a/drivers/auxdisplay/img-ascii-lcd.c +++ b/drivers/auxdisplay/img-ascii-lcd.c @@ -32,21 +32,21 @@ struct img_ascii_lcd_config { /** * struct img_ascii_lcd_ctx - Private data structure + * @linedisp: line display structure * @base: the base address of the LCD registers * @regmap: the regmap through which LCD registers are accessed * @offset: the offset within regmap to the start of the LCD registers * @cfg: pointer to the LCD model configuration - * @linedisp: line display structure * @curr: the string currently displayed on the LCD */ struct img_ascii_lcd_ctx { + struct linedisp linedisp; union { void __iomem *base; struct regmap *regmap; }; u32 offset; const struct img_ascii_lcd_config *cfg; - struct linedisp linedisp; char curr[] __aligned(8); }; From patchwork Thu Feb 8 18:48:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp458904dyd; Thu, 8 Feb 2024 13:20:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuXjTInxNjYchPpjj4RrMiZWTgd7mnsWzXEksTHsU86PzMk+nFoXKoIfM9bjtCJwYuK+eh X-Received: by 2002:ad4:5bef:0:b0:68c:5d40:d0fd with SMTP id k15-20020ad45bef000000b0068c5d40d0fdmr722834qvc.17.1707427209919; Thu, 08 Feb 2024 13:20:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427209; cv=pass; d=google.com; s=arc-20160816; b=Acx9dGevSvzL+XW7J80Erby7Cld7LEmQGMcudH/OuhUMc+igxQmjWLvVbZ1+g3Gg1i JcIXna0FL7R/9f/3ToZvv/jHYZUERp2oAhvq1wP2TS4+15S3zj4oqS51aHXdfnzGEB+b xT+QvLWLgFW+brby/eenFgLYIcvH1MY7eNIsLdnwXVQIcxEO/33o6oXWHyx2Dmlra+bv WLilB/JNP8fiuAC1/YQovvbsZLC5XzxT7Tgwg4yjDv/QoH0us3Jb7X2qln9V8cw3rCn/ fGIozV6FaOrsZBpW0pCFbA59ydJ5OQO5c6EbzWpQZOfLeLTub4V9EfrET+jDIO4QSjl4 azQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6+WB38byI/XswdNKZo2L4rIz6zyATe1cpxc4bxsghTg=; fh=Fg1YJVcncIEqDpmai341Lnxk3+r3CM/JY0guoQ1+aWo=; b=KURs4LViYo2dyyVRF2LVwIgkhzX+4GnltTp8O4iHZxnDK6Zbyc6MnxlukrrTdYumFw IPU906DT8Oc5Ebm5X42AZz7BkZTFToOKYgAZWYL5jFv8IB9TrPcuVC+21c8DxN3elUMx 5gisQmy/6HUDkqlAhyinHMkbImbm3fk9XnV+h9sYFLVsztDee/TH0z9QXtLRbdgSlNs2 wDnRSb4uxOZzOc8zmAJlEU0LA6oTwJ9ww7gFW855tPYpW5ZPWzC6S9ZwPl/GHlepGiL1 i9+kc8U/5ouHZii+nIgen7bfDwG0DKSl1+Bjb4BSdil8FNuUvkMMCgf4VKBsxvJeQvj7 67vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ull0gAfJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWDtviI9uL4fWrnE6wwinhy99hCqc3ygxNKLvPahcXsaXW1awiNLXS8Dg1Mc6gVVzWT/IzR0u6qBS16jMgJq+QqbV5ooA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u14-20020a0562141c0e00b0068cbfbee34esi418737qvc.294.2024.02.08.13.20.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:20:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ull0gAfJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58562-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58562-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 245A41C298D6 for ; Thu, 8 Feb 2024 18:53:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77B003C460; Thu, 8 Feb 2024 18:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ull0gAfJ" 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 54E2728699; Thu, 8 Feb 2024 18:49:29 +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=1707418171; cv=none; b=Zr5v2YUk3Co+3L/O8vg5bbEpg5ThLOVQpKZEdST3USMK/4OTKq3iLjGU+y55gqcf53tuLw0oUdoq7baXiZJMiwqvURXr5olSvNK8pRc0EBHq0Ty4Zzw/6rCNmtOcsVJsCBhwHMcW9yMtDFMYCxkMubZ8gcmSLWq/C+LKT8CDd00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418171; c=relaxed/simple; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AU7KGpekw2luZvZiVoLSHvcyY4/aqdECwvfytXrbU8R7trXSVCPU67ZB2DfNn0/RS8y4QT86n89PytLlQIDTL2VXutD+b5uwoHkuukiuvgnmNpOCG3PMevmqJB1hnhqwsC9WZ1kCf/31kiJDH43zJynhffxyIRg5IOXj9S1I63Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ull0gAfJ; arc=none smtp.client-ip=192.198.163.19 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=1707418169; x=1738954169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; b=Ull0gAfJM6EgYPO9Fzm1s1DlV/Yedc+qV8TUHOf3/0kHNSuFmqbkRCf1 9O3raJpxjc1cOZy1Ew66oYALq+f9taZwGKcj3lKUV6yOeawz7Qoh52FVU 2vrf0ZrT+hu1Cs8RSL+3TKGaJGPkpShX1A9KdqEZGrFzRBsKLbZVGZIw0 yq/PwwLadF8+pg7r80EFv6J4cUCriX+jKmYBGBEvWOgNlKtM5rVW4WYxl 2n92zBsj8GJ8ziBhvvjDgjRUwaIZ+4q+58iW4FMVMAtFCw2ij8EDRWqTO i0C84p6IanuwjNiYFyjSxg84i1YLOBe0rIha4t0buvSOffW7zCJSdh8B/ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186100" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186100" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215516" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215516" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 44C0113C; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 02/15] auxdisplay: linedisp: Free allocated resources in ->release() Date: Thu, 8 Feb 2024 20:48:00 +0200 Message-ID: <20240208184919.2224986-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790367194047282963 X-GMAIL-MSGID: 1790367194047282963 While there is no issue currently with the resources allocation, the code may still be made more robust by deallocating message in the ->release() callback. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 03e7f104aa1a..310e9bfb41ae 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -188,8 +188,16 @@ static struct attribute *linedisp_attrs[] = { }; ATTRIBUTE_GROUPS(linedisp); +static void linedisp_release(struct device *dev) +{ + struct linedisp *linedisp = container_of(dev, struct linedisp, dev); + + kfree(linedisp->message); +} + static const struct device_type linedisp_type = { .groups = linedisp_groups, + .release = linedisp_release, }; /** @@ -253,7 +261,6 @@ void linedisp_unregister(struct linedisp *linedisp) { device_del(&linedisp->dev); del_timer_sync(&linedisp->timer); - kfree(linedisp->message); put_device(&linedisp->dev); } EXPORT_SYMBOL_GPL(linedisp_unregister); From patchwork Thu Feb 8 18:48:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp521137dyd; Thu, 8 Feb 2024 15:42:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqjDP87J00rAZ2eEPZeMypbapeusV+5CHBl/u5SRQkXuacBhdvExY/F3DKn0w0G5DQA5KK X-Received: by 2002:a05:6402:505:b0:560:bea6:50c9 with SMTP id m5-20020a056402050500b00560bea650c9mr63199edv.14.1707435757935; Thu, 08 Feb 2024 15:42:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707435757; cv=pass; d=google.com; s=arc-20160816; b=ON0eM+9/FWVW1EdPY9vFr+2J4z1NPK2y1hkW3tfSZQyen01jKiYR0i7J5K7R2Mv49M rclijxEQm4pn/Ot47g5JNzsC82/jK05hQn7RGpajGYXq0V/Qllp1fvWSwyqn/LWHZASz hPwMUYFyZ6r+CVFWAsNKH2F1A+LFgxtLDY2FNY9MGU+Ar3LbedRbzn2r9/AV0/iybnZ4 m2ZatCsNJK6sbzmOW18MmoV38ukCnGE3E4vBGmvkPiSpuTHEc2/LiE3Kn8G0r96Ldcor 3j7Bx3VXARIETCGbS92ybcEPebRM2N1WNnPqx3dcFx7YLTG0WsYlqQ8euBKIoLQkOtDz /6VQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CrrL9zswLR7T+/jMsTSJ1HgKN74bXvsZvsqSVGYxPx0=; fh=OYzieR4uzt1JjdOu6oxqmpZS53L8A5e+qWjiFVb+QX8=; b=VC7Z4cUdMVoBurH7sEJuznl8khptzmHGXniFjVRxoO6mSO27NtTwg1VuGLNdoS3mI0 Rtzee5nty/GPSVY+PHaEs/PWdec/V4xC+JJAx2L55OWW1PYF0EdH8UAad7zWlp834RoD PvNKzDu2d9r103AOToyXdv0ke7RbXyO7jkK5ZqTcbyNbE3jY46dL4gAE+JR8fz3+MbUb AjKl5QRxeytIbaBGsS2NWiM9GkPRZX7edAw0RSUMlU2mHS1Lt0dCWTLprCOrSudzmm1P ZrixJ37IgG2+6liN97pg0LnPVlFflPOzlTqI94k5NdIC3gnQ0q0yOWC2nISj/dwBD8MR EKqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RkEyE7SD; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58559-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58559-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCV/n33TMdQ1g/AkZepz5fTmO/6CjX8PglNbGRThewDFYzNrUSr3c24XAvlXvahi7z8uICOJczoaOQ1XdF1B2wzW8/KVZg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t14-20020a056402524e00b00560b80e153bsi222133edd.66.2024.02.08.15.42.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:42:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58559-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RkEyE7SD; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58559-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58559-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id CB4DB1F2DBCC for ; Thu, 8 Feb 2024 18:50:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FC1F34CFF; Thu, 8 Feb 2024 18:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RkEyE7SD" 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 220B623769; Thu, 8 Feb 2024 18:49:27 +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=1707418168; cv=none; b=aGc7zyBBlvUe82E9p5Yr2zEiJz2eQnT0Ygt/lzOVdDrPgpLBzgmVcMpU0Cr9037y8nV444XVxJWCWbEQuYb0tYOJRM+Iil79sxtheU3cm9EH82t5QE39uOYS5reaVfBwvdlP+4sZ1Wgs2EZeCRXdj8xsp4k4+JmmqCc+5AkroJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418168; c=relaxed/simple; bh=LvC0jNLSvlISq+pfX0tunOut+CloWPeckMMVxbBHVes=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NW7OmF4ZdehdFH0MJMKyW3tguaVVAxLTY8Dk+DgURLNK57nSvX6a1H0/24UJm22fXs3akQ65ArBxqdb73Sy8k7O93zRC6dfPkMT56l1SayOPsvsVD5J0zE6nirE/O6rfSazacGyVrXsOuyiVWQ/9yCOJ25ZKbF3p6p1fZBVB9e4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=RkEyE7SD; arc=none smtp.client-ip=192.198.163.19 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=1707418167; x=1738954167; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LvC0jNLSvlISq+pfX0tunOut+CloWPeckMMVxbBHVes=; b=RkEyE7SD3POtTy8ltnwXMDkbN3t6HkF7H7CteCHFV0QDiyaVvoWNh+Zg yOqKbM0Evd631cDjzhLnLO2DX1YmhLsxoMTJW6o7FjRtXRY/u1yhCY6Sp yke4HE2BpZVmVZ7Qy+1X6qel5Rqc4mAcD7PWErK0cL5S5OQmk20R6n4Vm Y4iaBCs0Jnul1SY5Voyek9NaK7NXVAv25tfri+YQSpi6DCAEnlEwBMmNs zGhljZ4UQc0+xEnTDH/X1scevCCcZAhHUtwTI71SBRxLdvVZ17PrWhFva /2f0AvUIHwkYtR+iMNp7fc6wBUXCEAOarq1j7H1ksfDFKdJq/o9RB8RD6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186082" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186082" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215512" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215512" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4D0DB1FF; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 03/15] auxdisplay: linedisp: Use unique number for id Date: Thu, 8 Feb 2024 20:48:01 +0200 Message-ID: <20240208184919.2224986-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790376157016022674 X-GMAIL-MSGID: 1790376157016022674 The absence of decrementation of linedisp_id is incorrect in two ways, i.e. it may cause: - an ID exhaustion - (and if the above is addressed) a duplicate id number may be allocated next time a device is added Replace above mentioned approach by using IDA framework. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 13 ++++++++++--- drivers/auxdisplay/line-display.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 310e9bfb41ae..c4dbb13293d1 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -188,11 +189,14 @@ static struct attribute *linedisp_attrs[] = { }; ATTRIBUTE_GROUPS(linedisp); +static DEFINE_IDA(linedisp_id); + static void linedisp_release(struct device *dev) { struct linedisp *linedisp = container_of(dev, struct linedisp, dev); kfree(linedisp->message); + ida_free(&linedisp_id, linedisp->id); } static const struct device_type linedisp_type = { @@ -214,7 +218,6 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent, unsigned int num_chars, char *buf, void (*update)(struct linedisp *linedisp)) { - static atomic_t linedisp_id = ATOMIC_INIT(-1); int err; memset(linedisp, 0, sizeof(*linedisp)); @@ -225,9 +228,13 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent, linedisp->num_chars = num_chars; linedisp->scroll_rate = DEFAULT_SCROLL_RATE; + err = ida_alloc(&linedisp_id, GFP_KERNEL); + if (err < 0) + return err; + linedisp->id = err; + device_initialize(&linedisp->dev); - dev_set_name(&linedisp->dev, "linedisp.%lu", - (unsigned long)atomic_inc_return(&linedisp_id)); + dev_set_name(&linedisp->dev, "linedisp.%u", linedisp->id); /* initialise a timer for scrolling the message */ timer_setup(&linedisp->timer, linedisp_scroll, 0); diff --git a/drivers/auxdisplay/line-display.h b/drivers/auxdisplay/line-display.h index 0f5891d34c48..1fbe57fdc4cb 100644 --- a/drivers/auxdisplay/line-display.h +++ b/drivers/auxdisplay/line-display.h @@ -14,6 +14,7 @@ /** * struct linedisp - character line display private data structure * @dev: the line display device + * @id: instance id of this display * @timer: timer used to implement scrolling * @update: function called to update the display * @buf: pointer to the buffer for the string currently displayed @@ -25,6 +26,7 @@ */ struct linedisp { struct device dev; + unsigned int id; struct timer_list timer; void (*update)(struct linedisp *linedisp); char *buf; From patchwork Thu Feb 8 18:48:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp490355dyd; Thu, 8 Feb 2024 14:30:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbA3+ldCsU7QTrtKnBJw6a01k/PPDra/OO3p94EUsJYzUsupq2QsMkEK+ODtJJ5wTrf1im X-Received: by 2002:a05:620a:b8e:b0:783:f890:8aac with SMTP id k14-20020a05620a0b8e00b00783f8908aacmr916084qkh.24.1707431411437; Thu, 08 Feb 2024 14:30:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707431411; cv=pass; d=google.com; s=arc-20160816; b=tMl0KRdvTDrIkwWD5HsfIi380ez0f/W8gzi/c3Q54rX9aZBP1U9Y2DoH1kSREqMoI3 wkCt6JS+wG5ouhpi2BDELrMahEnpIjO8o7norXrxzmz0BuJPDRAIy/V00rN/38U255gz odVQC4proZy3UJUqn1P5M2FSXJ+2qcEP0RJrry0UKq0m6B8z5oqMOFfPZEuGx5OlWSkC XsyiOyoy3Y6T+J4l5LtoLaL6D0qDtRJ3PgmJtHK3OhVjvmilQnEP4X/I1bwe8DJa/kd3 NG20Ai8jjlFL009IqWxvs3NlXCibe5dztpnLW+PG0Ul3RtZIWIoO7EO8aBr2eg26dZkG 0FOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YXvq4nsTthWnNOvah4CH5HkIfAdpdthoxHgoZBMOdlg=; fh=Twi6Q3+Yf3WzOjQvqWvUyoUpryX0VolynICyvfLnhSM=; b=gxFQfNDJhHIqaxx67rJtsrRT7m3VtStWhnjsBxHnLWLHYcl246fU5R/rIZlxIUXHCt SHdR/iok8qKJ1RMC3icmguJPaU8WnyKV2+PWmaMpUhnsLkrf8EcFJ20yXsQQumm0IyXi FsgjSF4M9GhXUzzzCTKOwAkK0VRjLFO1TWs7xDxxJ9mLmW2XCHteq08dtY8XB0+tXj3v vhlBKUHF4gMq8dozaVEc4VJJM5lhky8BW3rrSsMooFhKxaIbA50D8F+onEzm4FbdDGRa WlWfRVmUGn1myLH6YrqXVhcoCzY82wC70TY2Zg97wb2Ls7JeJlHpfVIU7KEwt7pX9llt J6pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R3btefzz; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58560-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58560-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXbICW2XkASinPtxJ4mt1omIQmi08lTczt0rAO2Qe16Cr/KNzFNQkTokWVEY4vGBqbIWvfCXI6+w/2UXAGl/qQkstonew== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b20-20020a05620a04f400b00785afab92a9si610299qkh.233.2024.02.08.14.30.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:30:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58560-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R3btefzz; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58560-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58560-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2D1361C29699 for ; Thu, 8 Feb 2024 18:51:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBDDA36AE0; Thu, 8 Feb 2024 18:49:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="R3btefzz" 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 BD07F2556D; Thu, 8 Feb 2024 18:49:27 +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=1707418169; cv=none; b=QID3bS/xMfCKdIA+nzGefU7ztGzolgYpTx4eqTlltASIp/aVEVF63Kh4mNSVk+hmZHa3gxODpEtBcG2Rjwje1vNnHwcOQ8ayP8/5t+ne5Di//swgnJ5iuw1XovF/0Ln4u6BLbagPkCL6+3z95EpIHy0gsYNhVPUbtiamdpdcktg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418169; c=relaxed/simple; bh=xSKeAKNBA96roisQYOcxV4QilUZU+Ks7Czd6oPoWOHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HcLMgYOJEkumR2LJj0R1iH1xrnNa2lAvOZ9ILp2CmefqAv5e5MZxV/yK5itE7YijORoMSemzfNIuik+hpWBCZnwH0hPyfrZ7bI+xtSWqmsZIHE6m3PgTC+nyz3dJpbnh/EGG8hBBD0wnX2v1aLGKsfFRv78VzyBDTECNjQIBkE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=R3btefzz; arc=none smtp.client-ip=192.198.163.19 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=1707418168; x=1738954168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xSKeAKNBA96roisQYOcxV4QilUZU+Ks7Czd6oPoWOHU=; b=R3btefzzCOmPypUcdfnxzpNw3uuaOhiP2dje0z/Jh8UGVUesKjrIq0GW 68F3L2zIGyH3Y2i4w/0cxNEDNQuHDen/FO5djOOwTXKAZjHlAjHsd69Ws yJjqoED7VQa723nZpQ03dOm0FVx/i+HW3aoXGLZ8dPvOA++GslzqMzfrB uE8ahgWVQXKW6fFBPd7mARsKL6BDPf5hFyaDwry25WLRRD8JSQJ6r8Pu0 PtSGtKdHB21CfQnF06xejPbHI2pZ6PePUks/BA9WKnZIIWvazCsPvq/Zy olwQUI23SA6I0ayQqT50iVTMs5gwPeWHljfXdttQd6S453uRtKtmxdll4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186088" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186088" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215514" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215514" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:22 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 557F532F; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 04/15] auxdisplay: linedisp: Unshadow error codes in ->store() Date: Thu, 8 Feb 2024 20:48:02 +0200 Message-ID: <20240208184919.2224986-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790371599479599781 X-GMAIL-MSGID: 1790371599479599781 kstrtox() may return different error codes. Unshadow them in the ->store() callback to give better error report. While at it, add missing kstrtox.h inclusion. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index c4dbb13293d1..4b92ae7781f1 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -166,9 +167,11 @@ static ssize_t scroll_step_ms_store(struct device *dev, { struct linedisp *linedisp = container_of(dev, struct linedisp, dev); unsigned int ms; + int ret; - if (kstrtouint(buf, 10, &ms) != 0) - return -EINVAL; + ret = kstrtouint(buf, 10, &ms); + if (ret) + return ret; linedisp->scroll_rate = msecs_to_jiffies(ms); if (linedisp->message && linedisp->message_len > linedisp->num_chars) { From patchwork Thu Feb 8 18:48:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp472639dyd; Thu, 8 Feb 2024 13:50:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXh4Qf/gttAWygzMFbygmBDeH+VESGyaSfBCcSPbehveIyg2y58M5nYv4WIfCmU741vutLXS8owhgBP4Yc4Oq5veGG/fA== X-Google-Smtp-Source: AGHT+IF3Zd1HPm4qx0DtJyxlrAW+h/70tSaWJ2zjJJsWz9sWUiGtDOM5wWxvlyWf0SQoawLTJ4/4 X-Received: by 2002:a05:620a:4904:b0:783:1e5b:8e57 with SMTP id vy4-20020a05620a490400b007831e5b8e57mr5189217qkn.34.1707429024403; Thu, 08 Feb 2024 13:50:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707429024; cv=pass; d=google.com; s=arc-20160816; b=OiW8Arsd180pUczY61P7eokeVGzDQ5n1XlsRsFSpE+iwbUg6ioXv2iH27jXgpKQxNB T7CW6+IhYoviMwbTcwtjRZa/A6AvfU0kcE63f5undh3Men1MSQ2klw8YBy19dB1eV5G5 mJnEhcD2C1dHaExSsgoHp0zGyJUXEtdo3k8xCgJF4/Zg1lsFxIYc2C5QkdYWZ5hkjoYK ID+Qe2L3OrP6DCF+7LmmIyoIHhFASO8brXmTFK0AmP545qme5wsBJWI7QDEvLXtgR9Mx R9GoqyPaDeBB2Giwlg6Ehq6+vbtnlFonhPUEdT4UkHd/PWIbhs0MVYNlFbYB9Wkh0jNg dsDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PqKJxamixirN5e/2oO52DwLIZAu8uLiCIxk1RRyZPWc=; fh=HJ1V9BiMVCYcbAn+WvjT2gVam41tbZmNo53lV+klrlI=; b=pnal7VqRg/4gV0x1bY9BjtspYplpvJy0DS3ZzqEw2NfD7e/5szcXle5sJDoSisH1g3 RTLBCyMt3BN7ZigMRkRAmj09TNrlp8pXRTo0zOlxUGq5alWEBchq2W8hbdjaB9hiemYY KmXZr/kjVxfh9+xGc2NQ+NLVBJMglWJXAULXBd39R1z6mw6wNDTGVMtrmMyPTSmHZ9Zj QJJCDpAHVflAbpIHlsW1pYR0WLrxYNnba1LNbcpxLSIvRYoCG1b3LAj7lwl/GZnImYcQ 3u/d7MmM4Yr4mt4KhwRD0o+ZTx8p9vJG1chgmh9wmshLioT1yadr0PMDbhsJymIzwSeE L44A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FqlpNeW+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58564-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58564-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXNRVQumsjtQzVnSLzIP35QluX9MaN44BwBFUMvMJk3LkVoLoXbIqe0lNj+5xS1Whzx5A+f+fb7g4UPf8wp8Jn+hXcfsg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r8-20020a05620a298800b007859eebc43csi634883qkp.282.2024.02.08.13.50.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:50:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58564-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FqlpNeW+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58564-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58564-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3FAB21C29190 for ; Thu, 8 Feb 2024 18:54:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B593C25566; Thu, 8 Feb 2024 18:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FqlpNeW+" 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 7D9CB25601; Thu, 8 Feb 2024 18:49:29 +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=1707418171; cv=none; b=Tr4XC4ayyRsooRnXg0RQf0uRA4OO/RjE9o/jtFDsy+BsKLZFW9gc2GWb7PmWj/iJsJRPpqPHkGbwB4h5dOoTjE8rHzW/wfBSJgyaS2iouCeDeceQrgpjPIzqBFmmFQ7OkmsNRDwH/pmw15nS/CKD1tWEcLFGGy2RC0EmRVLTt68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418171; c=relaxed/simple; bh=FC1cjzT0133HljBbHlbObVyjHCu4QTG/1Zt/QXNpVSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oii71mtQF7otWjCl095G9BOgsNd+1q0LVWTrEpweatq+gS1ZZV3rKAU2afAGzSDgPWiqU53sKWHIIs3hHYeunbFxJU6pwRaAv8khDIwX/i7kBY9sPXRvTt7AzOWPk2jkCK1uejl5NUk8L704iA8mY4ie8urJORYlLrJQA6wSMSg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FqlpNeW+; arc=none smtp.client-ip=192.198.163.19 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=1707418169; x=1738954169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FC1cjzT0133HljBbHlbObVyjHCu4QTG/1Zt/QXNpVSA=; b=FqlpNeW+lbDvHeHIE022F/CyRT2UJymtasBjmTiV9RexkxAsXSUrATip ClDAAIX3IApnW+lSoszuXKLNaxBRinehiVkr3yEXw+Hjvf9Z4YU8EQnxB dD5NnQXzzyd/dbfRTTLg4SKOBKoH1E5NKoOICpxWGkCYVkPcFAdRc67yo wHT5ZUcKYMxgXJVKN8N+0j0IdBrUfW5HKFeBba3P+X1coxKFLLarq2hQh 8xAl+ZIXtZ5a8viPOt/ASiu2myqIVuZxoiTXIfzlL40XcHtuhg6ukfAuX T/CqAzSA/Xm9hU/9lqLY3WfNjQmkIbCrHuL/cJ5pu0mIdx2YPU64GGcrl g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186112" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186112" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215530" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215530" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:25 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5E3254C4; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 05/15] auxdisplay: linedisp: Add missing header(s) Date: Thu, 8 Feb 2024 20:48:03 +0200 Message-ID: <20240208184919.2224986-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790369096668588474 X-GMAIL-MSGID: 1790369096668588474 Do not imply that some of the generic headers may be always included. Instead, include explicitly what we are direct user of. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 3 +++ drivers/auxdisplay/line-display.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 4b92ae7781f1..6b3d25e20eeb 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -10,8 +10,11 @@ #include +#include #include +#include #include +#include #include #include #include diff --git a/drivers/auxdisplay/line-display.h b/drivers/auxdisplay/line-display.h index 1fbe57fdc4cb..d72c1899dc50 100644 --- a/drivers/auxdisplay/line-display.h +++ b/drivers/auxdisplay/line-display.h @@ -11,6 +11,9 @@ #ifndef _LINEDISP_H #define _LINEDISP_H +#include +#include + /** * struct linedisp - character line display private data structure * @dev: the line display device From patchwork Thu Feb 8 18:48:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp458630dyd; Thu, 8 Feb 2024 13:19:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUYOlNI8+lirQ9CUJCKHq62cko5FzOJMKX5GeUzj6HwWENZeWYizCMI1O9h5KLKXPmNVaE X-Received: by 2002:a17:902:f80c:b0:1d9:760d:31c7 with SMTP id ix12-20020a170902f80c00b001d9760d31c7mr412057plb.29.1707427171354; Thu, 08 Feb 2024 13:19:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427171; cv=pass; d=google.com; s=arc-20160816; b=th5jDLQnIRdF6UhVyrTsLHbPFg+RrwELlCQ+Dw3Bon7DnJvolc3esnlTf6xvD2+NAG CRGrMldjIVj+2bSDm8uggb7umN3hKIC4S3uFgYljbBeB5fpelKe8y8IORkIZgP4TkCW1 fQjjtBVgHoRrquGUmiazFs/TDvACdfWiy9onmjTY7aZoZNEV0htrFRBOrj7hPJl62gH+ q/ns4OjBpx+33NmNAtyykfktxCxCPZWuu913Gg7NM7+g9ru8Arv2GsKSYpazi+YbdopV ceZlTjCwlCHlwqx89WHtin0aWCtIK7crvLcbgC7au2TnT3k5oQm4E2gleaqndBjZSiiu RY1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Im8sxIYdnsOh/O09iVixyjYqCb+RPsBx8cBLwd5LxZg=; fh=DSNQMxp3LZ4FJmDSS0FoMxdNsd2qVzz6tZ5z1iRj7ec=; b=y+urKGGazc52IpPvoUP3nJpdAAb0PiHGzqmXemDU2AY0IhT+8AcL8kjDd2R8vR43hV lSvcOEEncriAnp+QxzpJn+p/f3MTewVbJee/7Lue0UJ6Qnuve6QE0uYFlkrQwUL3sGej YyzurP9d/0sacNJqi/a/NGtIDDSbtAfrQvqC+L0baT3IFb5hUD4xD9tnzj6Z+zISgVhL y4I4wZxl05d0glcuTQlQWZtz7bGL2bQt2fGA8LfotzvUl3fDTS8NU20JDmu0qpArL8Xw IgfWC7JSvQQgXGiPPX7pkFtYwmQ3Jx9GM4hgEkYllQgkyy3pHvgzk6p3ORSiK6q7kXOO HKMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kXJR22dM; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58571-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58571-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCUo443s8zENDUsiFZU4nuuedntm4SIdCj1W/x0WtSeGaI9i7bmIPX67UnNJm6mABUGQDkWCqGqzkQo4DED/Y122uIJUEw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id jj2-20020a170903048200b001d8b574af48si345611plb.230.2024.02.08.13.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:19:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58571-ouuuleilei=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=kXJR22dM; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58571-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58571-ouuuleilei=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 A364F284C19 for ; Thu, 8 Feb 2024 18:56:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3C5B4EB43; Thu, 8 Feb 2024 18:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kXJR22dM" 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 1A613241E1; Thu, 8 Feb 2024 18:49:32 +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=1707418174; cv=none; b=pvaV5NRaIwGfvkn9Je3oAnk+RMy5GgnpQ3C6c4GIu2wlS/2eI6gpy0d7J8GDmACE9GfVa/oNjO/fSY0mgEtn5IO36MCgTnjFB9tDvedEKEAREQEhXQLNvjZLHh1EaiJSgY261X23HHaCzRyvIxENO0oCFnKP0OPrDzoez6id5Ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418174; c=relaxed/simple; bh=CF1pX065yGAbwnIQLmXi74KKJnRft9elRt9o2Olm5iY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ml0gfN7JqZ0tTo0sQcYtqa+wyL8vwzQiGDH+tS4ar86+RPtUEg3itOldKKpric/3jMsRMeLupyeG7Ua+FGOz1CM7gOTGXeRPGIER5buewhAwWpHzBZO2pVEU7YF3/NdRyrnzVaVyZ7fen8CijyGoUkQEZkm7NIav2AYYCc0HpAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kXJR22dM; arc=none smtp.client-ip=192.198.163.19 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=1707418172; x=1738954172; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CF1pX065yGAbwnIQLmXi74KKJnRft9elRt9o2Olm5iY=; b=kXJR22dM4kGGLMdYM5E7umSwxoRLAkXpSgk/LrRN1q/1zuYEcdJiYqNt LEhdev3OSBLWXo6+GbTVrGJJvkkFNbqIEOwoduNOSaMDxjenSkQzl1Q0d MSIqlReqJ3sz170aNiGeFNM1sp5slTTylg/wGtXX4J30uXD+KBXXIMyVw ntu9L2UaSaAsi/mrgn8osCOrYaaNHXwj/Txqh6Vj1zg/dx8DwsaFQlUsB GmSiquQ1zAY0e74qG42QRV3I/RTHRjhxFDSZDiTWgC+djXzlWgQspgnyv noI8p3m9rKT7caSCkdcZk2PpvZy21IRhxq2TcHkiwMDfUwN2aEpAjByoq A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186131" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186131" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215532" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215532" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:25 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 661E5B2C; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 06/15] auxdisplay: linedisp: Move exported symbols to a namespace Date: Thu, 8 Feb 2024 20:48:04 +0200 Message-ID: <20240208184919.2224986-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790367154129033498 X-GMAIL-MSGID: 1790367154129033498 Avoid unnecessary pollution of the global symbol namespace by moving library functions in to a specific namespace and import that into the drivers that make use of the functions. For more info: https://lwn.net/Articles/760045/ Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/ht16k33.c | 1 + drivers/auxdisplay/img-ascii-lcd.c | 1 + drivers/auxdisplay/line-display.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index a90430b7d07b..c6a42c5c128f 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -831,4 +831,5 @@ module_i2c_driver(ht16k33_driver); MODULE_DESCRIPTION("Holtek HT16K33 driver"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(LINEDISP); MODULE_AUTHOR("Robin van der Gracht "); diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c index 09014ada38bd..c571e54d9eb5 100644 --- a/drivers/auxdisplay/img-ascii-lcd.c +++ b/drivers/auxdisplay/img-ascii-lcd.c @@ -298,3 +298,4 @@ module_platform_driver(img_ascii_lcd_driver); MODULE_DESCRIPTION("Imagination Technologies ASCII LCD Display"); MODULE_AUTHOR("Paul Burton "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(LINEDISP); diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 6b3d25e20eeb..851b2c0f9443 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -263,7 +263,7 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent, put_device(&linedisp->dev); return err; } -EXPORT_SYMBOL_GPL(linedisp_register); +EXPORT_SYMBOL_NS_GPL(linedisp_register, LINEDISP); /** * linedisp_unregister - unregister a character line display @@ -276,6 +276,6 @@ void linedisp_unregister(struct linedisp *linedisp) del_timer_sync(&linedisp->timer); put_device(&linedisp->dev); } -EXPORT_SYMBOL_GPL(linedisp_unregister); +EXPORT_SYMBOL_NS_GPL(linedisp_unregister, LINEDISP); MODULE_LICENSE("GPL"); From patchwork Thu Feb 8 18:48:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp511984dyd; Thu, 8 Feb 2024 15:20:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWgJxPBMavwVCxTxQD4G7GxBpLH9JOLtfPYCKHNSsY4WOfVAzQOcLzbaYhG5fcXnqf3w14+j1DCMxlyx3WGrtZaFTBH9g== X-Google-Smtp-Source: AGHT+IEu0xTbXTLxERGavcCSmo6zQqB2E2JXM5YBo07sRA5VgHX2hRyQ5au3dPhDz1xBH2dbRzSF X-Received: by 2002:a17:902:ecce:b0:1d8:cc30:bb18 with SMTP id a14-20020a170902ecce00b001d8cc30bb18mr693045plh.52.1707434401989; Thu, 08 Feb 2024 15:20:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707434401; cv=pass; d=google.com; s=arc-20160816; b=Jr+n/ZH3hsUm3woxxVTrIEYREmjMGwTQGC1aMOIJYqatf71zJc8Lw/D7Sl59tJSn+R P65IW+0NN6+LxlQLdK/j1pwPhzCxskIOjvPJuLFbNP9k9aun2Bez6kMTqzCNefhCWmpw ofX3ACuZaqgfBUbmuv2UJjYqgg1nJCEgRfvasNuXfLOWOVXMmBOOqwEbrdMggjBF1djw M8L4x/jFL9BiJVBupcTgpambwsFHkDHEDTZPNp8hrKcO/9SH/UJiTO2CiSBg9cOQmxqe lR4RNU+dYp8IJeNMo2VQv4SiOfG+zlYMRGm0+hpw+IorQb/uJHVZtqtZFtcrLaYcY1eU u+KA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=iJXgImdyiWl36jXfqlg7UOXNxx3T/hLj4YbpY9NU+vk=; fh=wdvnyIlUfTx4lTQCMApq5NFNdcdboayIRk1Mvbg9/40=; b=Zb2607J+30lcyl4OSe33/AUHT10WxaGtRhPH2/1WSUn0UtA6otWx+HH7E3yeYrg8By QLLp9KM1eTxYhHGD91Nl1cJIJBI5gMIby+Xkd2WF3ebYqaK42Y9xDhXfsYEyCOb2F3kT UuwsXL7MS9dFwpmFxFdQ49gQto81D31bmHTi+uxVMTY8DEvCLl8kF2hL7VPOp/nFBKKZ KCD1x7kHrR97+qJH6cBQZ24Rem7eAR5F2aVQhwSK6VpOmPfmHF8zXZG7tYQ36SXP2282 Da4TEzqqacEZS7I+hu8yfjojyzJ9HGuAhrWceIfPHQfO3CbeXltSu+qRMeUeSWernedg 4J0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OFWhm9OK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58567-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58567-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXSjGt24D51RqD+LBom/cI77mlvJlUaWWCvcQWVFYsmBTOH72RYtZjtaApTfrHqVrc1wNYiMyofbLbR156nSxxTNCDE5g== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l8-20020a17090a72c800b002933854dea6si521658pjk.11.2024.02.08.15.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:20:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58567-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OFWhm9OK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58567-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58567-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 51558B2A4EA for ; Thu, 8 Feb 2024 18:55:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C54A24C62A; Thu, 8 Feb 2024 18:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OFWhm9OK" 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 49BC72D044; Thu, 8 Feb 2024 18:49:31 +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=1707418173; cv=none; b=rQiZ8+hvtf3kAhjjMGOiWd7dZD7hPYdCxZ4H1n5GSSgA8pC2apNna7DSn0iyrsPy42/pieNlf8c5m3+jVhGTKPnopZdCLtoqZKtg8j8m40zdsEi58o4HXpulej4HcDxOwDaUqVJP/9S8t9Of1+kCWOOc8HWh1RY3PtI1GIikfjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418173; c=relaxed/simple; bh=Fg8HFd6qXwgrRuKizTmdQy4zN2vPEsdI81OkVtdnatg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gt2ZBJ1rBKTcO9GO57W1sV1lz/2eoErvq4hjwQ2OH+2rCImEFnSEGyM1cVdAxWzkn5X9ZupCcoWQFMAOHYYjKf0KO80Y3E+mFqfOyRgR8Vn3QV3UT0Tem2I8ETXT8IHyO00j85W6TMPLq/Yia5vB9ug7sUHvDzVGD3ADQ09nI8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OFWhm9OK; arc=none smtp.client-ip=192.198.163.19 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=1707418171; x=1738954171; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fg8HFd6qXwgrRuKizTmdQy4zN2vPEsdI81OkVtdnatg=; b=OFWhm9OKBi2ICSz9BlfzjdSrPO6mylkBy6yUc2JqoDPJUnGfF8hw9BDB ElhH+yaubG4bZ8BZd3iq0dGFqj+0et8yCum7qh9YgUqN4+9+UtP/wcy+l /pcorJi76mv7IP87nae1mXY6k49BVFY4KOnjwGVIHuTvPRwCNjZxJyC8D JoiCCa+fV+Uo02aLUVS7Y2zCB9EtFb5GIkFZuZzTP6RNiG+okXi2NBvOP kSbrg3LBrW6TlyE+gpjn0aNI8F7fN6cS9d234mNte8YZte8rec2/pPaCY qwKT4jcYyF/CsctB1qnu5P9wzRt6iabgv8mnEV1Nq3BC7xluvOptl3SQ8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186124" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186124" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215534" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215534" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:25 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6E811B84; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 07/15] auxdisplay: linedisp: Group line display drivers together Date: Thu, 8 Feb 2024 20:48:05 +0200 Message-ID: <20240208184919.2224986-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790374735671621856 X-GMAIL-MSGID: 1790374735671621856 For better usability group the line display drivers together in Kconfig and Makefile. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/Kconfig | 32 ++++++++++++++++---------------- drivers/auxdisplay/Makefile | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index d944d5298eca..a34a9a52158f 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig @@ -25,12 +25,6 @@ config CHARLCD This is some character LCD core interface that multiple drivers can use. -config LINEDISP - tristate "Character line display core support" if COMPILE_TEST - help - This is the core support for single-line character displays, to be - selected by drivers that use it. - config HD44780_COMMON tristate "Common functions for HD44780 (and compatibles) LCD displays" if COMPILE_TEST select CHARLCD @@ -52,6 +46,16 @@ config HD44780 kernel and started at boot. If you don't understand what all this is about, say N. +config LCD2S + tristate "lcd2s 20x4 character display over I2C console" + depends on I2C + select CHARLCD + help + This is a driver that lets you use the lcd2s 20x4 character display + from Modtronix engineering as a console output device. The display + is a simple single color character display. You have to connect it + to an I2C bus. + config KS0108 tristate "KS0108 LCD Controller" depends on PARPORT_PC @@ -153,6 +157,12 @@ config CFAG12864B_RATE If you compile this as a module, you can still override this value using the module parameters. +config LINEDISP + tristate "Character line display core support" if COMPILE_TEST + help + This is the core support for single-line character displays, to be + selected by drivers that use it. + config IMG_ASCII_LCD tristate "Imagination Technologies ASCII LCD Display" depends on HAS_IOMEM @@ -177,16 +187,6 @@ config HT16K33 Say yes here to add support for Holtek HT16K33, RAM mapping 16*8 LED controller driver with keyscan. -config LCD2S - tristate "lcd2s 20x4 character display over I2C console" - depends on I2C - select CHARLCD - help - This is a driver that lets you use the lcd2s 20x4 character display - from Modtronix engineering as a console output device. The display - is a simple single color character display. You have to connect it - to an I2C bus. - config ARM_CHARLCD bool "ARM Ltd. Character LCD Driver" depends on PLAT_VERSATILE diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile index 6968ed4d3f0a..43bad850481c 100644 --- a/drivers/auxdisplay/Makefile +++ b/drivers/auxdisplay/Makefile @@ -5,12 +5,12 @@ obj-$(CONFIG_CHARLCD) += charlcd.o obj-$(CONFIG_HD44780_COMMON) += hd44780_common.o -obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o +obj-$(CONFIG_HD44780) += hd44780.o +obj-$(CONFIG_LCD2S) += lcd2s.o obj-$(CONFIG_KS0108) += ks0108.o obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o -obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o -obj-$(CONFIG_HD44780) += hd44780.o -obj-$(CONFIG_HT16K33) += ht16k33.o -obj-$(CONFIG_PARPORT_PANEL) += panel.o -obj-$(CONFIG_LCD2S) += lcd2s.o obj-$(CONFIG_LINEDISP) += line-display.o +obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o +obj-$(CONFIG_HT16K33) += ht16k33.o +obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o +obj-$(CONFIG_PARPORT_PANEL) += panel.o From patchwork Thu Feb 8 18:48:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp500220dyd; Thu, 8 Feb 2024 14:55:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVsLJa2TJAuzEpcd1tjC9Lmip/VWDOebYCF7pVjREAI17Vi3GddpmnO7QdbRE1P9+Ce/RmYeHlKp+eHaSmztHNY3TzjtQ== X-Google-Smtp-Source: AGHT+IG5TkegYgihFXwfEdDYim96+u0w3XubJHTY82H0w2PTp336uANRKXmNkibGuD6Xz17WopXy X-Received: by 2002:a05:6808:e85:b0:3bf:e036:f0e7 with SMTP id k5-20020a0568080e8500b003bfe036f0e7mr770915oil.56.1707432922671; Thu, 08 Feb 2024 14:55:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707432922; cv=pass; d=google.com; s=arc-20160816; b=LaaffWR+HyI1LcNh2YxMWaAEOd/6rY3FO8CzuFBXCtMA/62NJrUYjvcYLXqIinYmp3 HEkPDBGeyAfGslAI4Q5pjMs88+LQ/5QTAbuj/+uEHCq2/w2K+wSsZrx/rK5mUVz00zk/ vmkMG0wq8n0XSGMdPBF79XXPS9Oxw5XNmRUE+EoLqOsNBb4Vt82fqT4epcT+ljgF8h4e bFO2f+nBX0DEevDAgFi8s2oDRsm08dW9AMY8+rPuJ40YUn8Zt3KoNTFYjxNhBWdZ368i A25OUBC58vmV6FgKAu7Z3HnmQKFKW39cs7sH5owleNPuSO2L+fAPAg4QcAcEbbdH3Gp9 C4EA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4PpB3sr59vnDn7WNWAHnBKk3bQc6g6YsW4xDnTpc4To=; fh=sRsubyUXcMe6ouK47imctkuqubcdQRqoQUuAh9b982o=; b=WL65BpLCkuD3X/QfOos48seMaCNX1QzGpJW51Q1sMEOQabXypjP+9k5BwWMfjSWBF0 /ENhdyJXWylV7L3Zbrto1c2LxelWklGIhgxxziVvGeSZLqDs3X4321YDOPUIhGxjdD/R PMvbOV0NOIbF/y87mAj7o7LSrHW0y21EkNbykdaJED84mrlKoAgT5yyUWx+mKT4G5DkW khwAd+x4kb7T8E3fbeHOYDZhnI9J4jwX/iI+hcMhjQ54ycmKpak8TbeD37lXXqT6rOyY zKrvT0NlKjuFYFxamTJlBnKHH0U2A4ZCh3IGghNQTIFWxoQySCioo+d0C1a2VxpaWrLi ywNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CcExyo2Z; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58569-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58569-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXR275a+iF72b01zvrMKV8+ousH7YDpabGk/nnAdgRxsJiNuaI/hn1UquHIWL5FYgcHkoPvGWGHz9LC6iAzs+1PwakK0A== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e4-20020a05622a110400b0042c24417999si537048qty.542.2024.02.08.14.55.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:55:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58569-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CcExyo2Z; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58569-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58569-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 802FD1C2A1D9 for ; Thu, 8 Feb 2024 18:56:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D09814D59C; Thu, 8 Feb 2024 18:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CcExyo2Z" 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 ABFAB28DD6; Thu, 8 Feb 2024 18:49:30 +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=1707418173; cv=none; b=cQqEUaGapcICa89GV1cg8CDwL/m9oW4YrKcvkzUF/fFLw5JtjzrE19jdRwPxKUonQ6kSAp03vW0z42GaIImJqAYky23toXHQVUMqwpiOxRXAqmvBpOxq85rB2gBkLYWfyVrd8Lz4dT86jJEZseCagJGmfwPmnLgM3kmsc3JOuTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418173; c=relaxed/simple; bh=fRF6aaXYm3WO7lZKrdtFCzyzTyXPONtxX7sbViupAFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gd3vdTWd9MiVKxWC2h2iQMTOoK7aoxvN87yDp5w/B2Kdk6DFCUl7CwTnh4cmAViiFgWzDw8JaPFS6VhjlE1qXZHDD3BLTSYepDXcjFBGcEb8Lc8X64CYKmGurKsM5uCSQwtrtQqeNIRk6UTxcfvjunUPyLpW3fyyTQ8bc/cmn30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CcExyo2Z; arc=none smtp.client-ip=192.198.163.19 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=1707418171; x=1738954171; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fRF6aaXYm3WO7lZKrdtFCzyzTyXPONtxX7sbViupAFA=; b=CcExyo2Zl2E3fY/QTEIm1qF3w0bkIdBGCSx7vDv779w3UmhXqq4dWkKp kMHsdnWmpR6SOAABYlkqqmh6LC/0khTJUVwyX86Z4M/jOBO/j/7ghNcIU MIAgso2Yp/GMLejrPnqw/3j9k8ZpamuPalQgkhkyD/ZeCEvbioX16Yrgd 5t+1zse7TlfRz7UJ8R+PD0DBNvM++H0rbHRPuIweauax+jMM6c3EMBrY7 jq0Q6WivrTXx/zA/EH7+mR/5UDdsi9OHKz+GBLPiGzsl4LmiMakyM5xk1 8X12a5OuWOtOhabmIvRZAUwURBwXncnz/v5tWveFWNC5UxBp/ubh9vr71 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186120" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186120" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215533" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215533" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:25 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7B81FBA3; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 08/15] auxdisplay: linedisp: Provide struct linedisp_ops for future extension Date: Thu, 8 Feb 2024 20:48:06 +0200 Message-ID: <20240208184919.2224986-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790373184417719665 X-GMAIL-MSGID: 1790373184417719665 Currently the line display library doesn't scale in case we want to provide more operations. Prepare the library to take a newly created struct linedisp_ops that scales. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/ht16k33.c | 7 +++++-- drivers/auxdisplay/img-ascii-lcd.c | 19 ++++++++++++------- drivers/auxdisplay/line-display.c | 11 +++++------ drivers/auxdisplay/line-display.h | 17 +++++++++++++---- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index c6a42c5c128f..0cdf3fbdf81e 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -448,6 +448,10 @@ static void ht16k33_linedisp_update(struct linedisp *linedisp) schedule_delayed_work(&priv->work, 0); } +static const struct linedisp_ops ht16k33_linedisp_ops = { + .update = ht16k33_linedisp_update, +}; + static void ht16k33_seg7_update(struct work_struct *work) { struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv, @@ -696,8 +700,7 @@ static int ht16k33_seg_probe(struct device *dev, struct ht16k33_priv *priv, if (err) return err; - err = linedisp_register(&seg->linedisp, dev, 4, seg->curr, - ht16k33_linedisp_update); + err = linedisp_register(&seg->linedisp, dev, 4, seg->curr, &ht16k33_linedisp_ops); if (err) goto err_remove_map_file; diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c index c571e54d9eb5..c0ec7d9a1c62 100644 --- a/drivers/auxdisplay/img-ascii-lcd.c +++ b/drivers/auxdisplay/img-ascii-lcd.c @@ -22,12 +22,12 @@ struct img_ascii_lcd_ctx; * struct img_ascii_lcd_config - Configuration information about an LCD model * @num_chars: the number of characters the LCD can display * @external_regmap: true if registers are in a system controller, else false - * @update: function called to update the LCD + * @ops: character line display operations */ struct img_ascii_lcd_config { unsigned int num_chars; bool external_regmap; - void (*update)(struct linedisp *linedisp); + const struct linedisp_ops ops; }; /** @@ -75,7 +75,9 @@ static void boston_update(struct linedisp *linedisp) static struct img_ascii_lcd_config boston_config = { .num_chars = 8, - .update = boston_update, + .ops = { + .update = boston_update, + }, }; /* @@ -103,7 +105,9 @@ static void malta_update(struct linedisp *linedisp) static struct img_ascii_lcd_config malta_config = { .num_chars = 8, .external_regmap = true, - .update = malta_update, + .ops = { + .update = malta_update, + }, }; /* @@ -203,7 +207,9 @@ static void sead3_update(struct linedisp *linedisp) static struct img_ascii_lcd_config sead3_config = { .num_chars = 16, .external_regmap = true, - .update = sead3_update, + .ops = { + .update = sead3_update, + }, }; static const struct of_device_id img_ascii_lcd_matches[] = { @@ -247,8 +253,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) return PTR_ERR(ctx->base); } - err = linedisp_register(&ctx->linedisp, dev, cfg->num_chars, ctx->curr, - cfg->update); + err = linedisp_register(&ctx->linedisp, dev, cfg->num_chars, ctx->curr, &cfg->ops); if (err) return err; diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 851b2c0f9443..62e8a911bb12 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -50,7 +50,7 @@ static void linedisp_scroll(struct timer_list *t) } /* update the display */ - linedisp->update(linedisp); + linedisp->ops->update(linedisp); /* move on to the next character */ linedisp->scroll_pos++; @@ -94,7 +94,7 @@ static int linedisp_display(struct linedisp *linedisp, const char *msg, linedisp->message = NULL; linedisp->message_len = 0; memset(linedisp->buf, ' ', linedisp->num_chars); - linedisp->update(linedisp); + linedisp->ops->update(linedisp); return 0; } @@ -216,20 +216,19 @@ static const struct device_type linedisp_type = { * @parent: parent device * @num_chars: the number of characters that can be displayed * @buf: pointer to a buffer that can hold @num_chars characters - * @update: Function called to update the display. This must not sleep! + * @ops: character line display operations * * Return: zero on success, else a negative error code. */ int linedisp_register(struct linedisp *linedisp, struct device *parent, - unsigned int num_chars, char *buf, - void (*update)(struct linedisp *linedisp)) + unsigned int num_chars, char *buf, const struct linedisp_ops *ops) { int err; memset(linedisp, 0, sizeof(*linedisp)); linedisp->dev.parent = parent; linedisp->dev.type = &linedisp_type; - linedisp->update = update; + linedisp->ops = ops; linedisp->buf = buf; linedisp->num_chars = num_chars; linedisp->scroll_rate = DEFAULT_SCROLL_RATE; diff --git a/drivers/auxdisplay/line-display.h b/drivers/auxdisplay/line-display.h index d72c1899dc50..a4f0d1bf5848 100644 --- a/drivers/auxdisplay/line-display.h +++ b/drivers/auxdisplay/line-display.h @@ -14,12 +14,22 @@ #include #include +struct linedisp; + +/** + * struct linedisp_ops - character line display operations + * @update: Function called to update the display. This must not sleep! + */ +struct linedisp_ops { + void (*update)(struct linedisp *linedisp); +}; + /** * struct linedisp - character line display private data structure * @dev: the line display device * @id: instance id of this display * @timer: timer used to implement scrolling - * @update: function called to update the display + * @ops: character line display operations * @buf: pointer to the buffer for the string currently displayed * @message: the full message to display or scroll on the display * @num_chars: the number of characters that can be displayed @@ -31,7 +41,7 @@ struct linedisp { struct device dev; unsigned int id; struct timer_list timer; - void (*update)(struct linedisp *linedisp); + const struct linedisp_ops *ops; char *buf; char *message; unsigned int num_chars; @@ -41,8 +51,7 @@ struct linedisp { }; int linedisp_register(struct linedisp *linedisp, struct device *parent, - unsigned int num_chars, char *buf, - void (*update)(struct linedisp *linedisp)); + unsigned int num_chars, char *buf, const struct linedisp_ops *ops); void linedisp_unregister(struct linedisp *linedisp); #endif /* LINEDISP_H */ From patchwork Thu Feb 8 18:48:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp427061dyd; Thu, 8 Feb 2024 12:14:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IF71oUlLOBSkf8O/aPoLN+5m7MG/2wJDKnm1+IX0SP7IEOD1pbweivgGgHH8AIXjBnba1RX X-Received: by 2002:a17:903:41c7:b0:1d7:72b9:b114 with SMTP id u7-20020a17090341c700b001d772b9b114mr269821ple.60.1707423246181; Thu, 08 Feb 2024 12:14:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707423246; cv=pass; d=google.com; s=arc-20160816; b=CkvphG3UNrMR6vn2cHVXO1oDCuPhMrMLx+j7tEDMFJm1IpE4CUxngNGh2H88nYkPjH yyn/lFwAIjpVFvVldseGhSg0reuuJ0GgeJhiPXP1kGEBPpQcE2YmWSv2NFGLZx2MT9yr kh8IvbN9V3S++Zo9UGoLCuUE/g7zVAPYF3CJDn+vQRCXIv+BL2+iB7vzLUplyd6WEnC6 vRd0DKK+KJI28Ma8BPaksIEFhoGX6dOaUuQfZWTlZ+gPOjNoGeE2RRrNZsKO8WSqHcDq vl3Gb4qfdeYaMtVNNbpptw1aZ8TGMkZEMtjdbYC3BG1Qv5MG77te6ffH6kqWADLv1EOK KHPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ci8+yPmYIAEycgOmeyBYkSA3AVyOrdAO+npl1p35NmM=; fh=daY6bHez49aX1z6Q4Q2TJ2GNJamUQ9ikLIYV1ATEcOw=; b=I4958J0JfssaSyc4a0H6wSDvDafKA3pTQM1kSfyn1SJR6nPwRqjnYIPURJ3f8ViSv5 Hq0jem/8uTf/iHAO2++USdFKQSBWBnPPmSULLpkShA3+jvRtAz1x+kGfRMEa8BGmdPrv 16e5Q1YiBLsd2mjpzs1WRMJT4ogV6+TE+iVwM/VoN+Htl1sdwxNS50ygg5tZNPt8FZmE MjfcVlLd0ZY0+y5WLnhwzE+R+RhGXk5oUJ/WJTjgW8lzUnyp+GT+nIZMp6cQ9JOjgc/Y MXdFXBKDbQLHO0ncpGcQAjv94ef/wVFhiReIRWWNwDXC/nj4VdvYGuqywKwo4JGyRQGX KQNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pe+uwKCP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58577-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58577-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCUXqTNM97+v32nOMcbC/PgB/rtwS7nkskq2PiQUot4C9DBm3thHaLbNU2uSgGNgCct3yApq7VBu3hODe+nNoB2+VjYlqg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m6-20020a170902db8600b001d8dba2d29asi283136pld.22.2024.02.08.12.14.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:14:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58577-ouuuleilei=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=Pe+uwKCP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58577-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58577-ouuuleilei=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 3D458294EA0 for ; Thu, 8 Feb 2024 18:58:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95D2650A8C; Thu, 8 Feb 2024 18:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Pe+uwKCP" 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 3C0A5364AC; Thu, 8 Feb 2024 18:49:34 +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=1707418178; cv=none; b=eAZXDONKZMkDYXKGescd/qNd30enCPzmZndRFn9ZSPhtejnflBU5svTvStXhg8sGIMB7hKTrJlWGzi5a06Eshe+KMn08XTGjWUoVtfaDtYTpBHUkT6PQqE9oRia7MzKI+4Eu67VEnFTd1g0Mzoxp0TRK7z5KV89bTl5XNB5FgPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418178; c=relaxed/simple; bh=D9KNXApzrQn/zL4buEhPq3QKCgL53LOywh6Etg3+aBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AHeXwGDXNw8tEwRUHpKVmsNPWldncZYsrcllgwnYFW9U1my+fRPk0uWTyViUqpJP3QG0fM/w+A55QNlHiVd/qXVliyLFXsA76oKD42GCTRlSBEWI8Zq9TfLp6INSBToulHcnbWi4cKgnvHlXaqvNBtqciXvNBLvjyJGb1Ad5cEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Pe+uwKCP; arc=none smtp.client-ip=192.198.163.19 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=1707418174; x=1738954174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D9KNXApzrQn/zL4buEhPq3QKCgL53LOywh6Etg3+aBQ=; b=Pe+uwKCP5wWcTI3OVyueNad9nlAVHlmgivd/tDuk8jnFOll/ptbxBN7R d1/qq97MKt4jvAW+w/i8jUPP9zErlewuXze3Y4rRHRetWYuUkX4eo3Ye0 AuF05TOKA+pMfkDFYgHRwC5yfH8ZRFRwozczCcfQmXrULu2/mk+UP4tV+ 99d3neBQy59Jcgkord1B99lgqXgEhtI7rJzObBjr+aP+GrGHYCA4FURmS izxbbhucV/+2MAqTjNn0+pardZQ6chf6bF2LVaiwY27WFr1i9ZdvkSgU0 SawjYMX3L+jePM/IQAEWK7bZREDm8Dd8sS5dLcxPU/0znN8XWxW214Sj9 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186135" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186135" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215535" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215535" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8401AF23; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 09/15] auxdisplay: linedisp: Add support for overriding character mapping Date: Thu, 8 Feb 2024 20:48:07 +0200 Message-ID: <20240208184919.2224986-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790363037810853935 X-GMAIL-MSGID: 1790363037810853935 There is already the driver using character mapping table for 7 or 14 segment display. It is possible to override it. Make the similar in the line display library to allow other drivers to utilise the same functionality. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 111 +++++++++++++++++++++++++++++- drivers/auxdisplay/line-display.h | 31 +++++++++ 2 files changed, 140 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 62e8a911bb12..da47fc59f6cb 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -22,6 +22,9 @@ #include #include +#include +#include + #include "line-display.h" #define DEFAULT_SCROLL_RATE (HZ / 2) @@ -188,12 +191,71 @@ static ssize_t scroll_step_ms_store(struct device *dev, static DEVICE_ATTR_RW(scroll_step_ms); +static ssize_t map_seg_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct linedisp *linedisp = container_of(dev, struct linedisp, dev); + struct linedisp_map *map = linedisp->map; + + memcpy(buf, &map->map, map->size); + return map->size; +} + +static ssize_t map_seg_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct linedisp *linedisp = container_of(dev, struct linedisp, dev); + struct linedisp_map *map = linedisp->map; + + if (count != map->size) + return -EINVAL; + + memcpy(&map->map, buf, count); + return count; +} + +static const SEG7_DEFAULT_MAP(initial_map_seg7); +static DEVICE_ATTR(map_seg7, 0644, map_seg_show, map_seg_store); + +static const SEG14_DEFAULT_MAP(initial_map_seg14); +static DEVICE_ATTR(map_seg14, 0644, map_seg_show, map_seg_store); + static struct attribute *linedisp_attrs[] = { &dev_attr_message.attr, &dev_attr_scroll_step_ms.attr, - NULL, + &dev_attr_map_seg7.attr, + &dev_attr_map_seg14.attr, + NULL }; -ATTRIBUTE_GROUPS(linedisp); + +static umode_t linedisp_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) +{ + struct device *dev = kobj_to_dev(kobj); + struct linedisp *linedisp = container_of(dev, struct linedisp, dev); + struct linedisp_map *map = linedisp->map; + umode_t mode = attr->mode; + + if (attr == &dev_attr_map_seg7.attr) { + if (!map) + return 0; + if (map->type != LINEDISP_MAP_SEG7) + return 0; + } + + if (attr == &dev_attr_map_seg14.attr) { + if (!map) + return 0; + if (map->type != LINEDISP_MAP_SEG14) + return 0; + } + + return mode; +}; + +static const struct attribute_group linedisp_group = { + .is_visible = linedisp_attr_is_visible, + .attrs = linedisp_attrs, +}; +__ATTRIBUTE_GROUPS(linedisp); static DEFINE_IDA(linedisp_id); @@ -201,6 +263,7 @@ static void linedisp_release(struct device *dev) { struct linedisp *linedisp = container_of(dev, struct linedisp, dev); + kfree(linedisp->map); kfree(linedisp->message); ida_free(&linedisp_id, linedisp->id); } @@ -210,6 +273,44 @@ static const struct device_type linedisp_type = { .release = linedisp_release, }; +static int linedisp_init_map(struct linedisp *linedisp) +{ + struct linedisp_map *map; + int err; + + if (!linedisp->ops->get_map_type) + return 0; + + err = linedisp->ops->get_map_type(linedisp); + if (err < 0) + return err; + + map = kmalloc(sizeof(*map), GFP_KERNEL); + if (!map) + return -ENOMEM; + + map->type = err; + + /* assign initial mapping */ + switch (map->type) { + case LINEDISP_MAP_SEG7: + map->map.seg7 = initial_map_seg7; + map->size = sizeof(map->map.seg7); + break; + case LINEDISP_MAP_SEG14: + map->map.seg14 = initial_map_seg14; + map->size = sizeof(map->map.seg14); + break; + default: + kfree(map); + return -EINVAL; + } + + linedisp->map = map; + + return 0; +} + /** * linedisp_register - register a character line display * @linedisp: pointer to character line display structure @@ -241,6 +342,11 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent, device_initialize(&linedisp->dev); dev_set_name(&linedisp->dev, "linedisp.%u", linedisp->id); + /* initialise a character mapping, if required */ + err = linedisp_init_map(linedisp); + if (err) + goto out_put_device; + /* initialise a timer for scrolling the message */ timer_setup(&linedisp->timer, linedisp_scroll, 0); @@ -259,6 +365,7 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent, device_del(&linedisp->dev); out_del_timer: del_timer_sync(&linedisp->timer); +out_put_device: put_device(&linedisp->dev); return err; } diff --git a/drivers/auxdisplay/line-display.h b/drivers/auxdisplay/line-display.h index a4f0d1bf5848..65d782111f53 100644 --- a/drivers/auxdisplay/line-display.h +++ b/drivers/auxdisplay/line-display.h @@ -14,13 +14,43 @@ #include #include +#include +#include + struct linedisp; +/** + * enum linedisp_map_type - type of the character mapping + * @LINEDISP_MAP_SEG7: Map characters to 7 segment display + * @LINEDISP_MAP_SEG14: Map characters to 14 segment display + */ +enum linedisp_map_type { + LINEDISP_MAP_SEG7, + LINEDISP_MAP_SEG14, +}; + +/** + * struct linedisp_map - character mapping + * @type: type of the character mapping + * @map: conversion character mapping + * @size: size of the @map + */ +struct linedisp_map { + enum linedisp_map_type type; + union { + struct seg7_conversion_map seg7; + struct seg14_conversion_map seg14; + } map; + unsigned int size; +}; + /** * struct linedisp_ops - character line display operations + * @get_map_type: Function called to get the character mapping, if required * @update: Function called to update the display. This must not sleep! */ struct linedisp_ops { + int (*get_map_type)(struct linedisp *linedisp); void (*update)(struct linedisp *linedisp); }; @@ -42,6 +72,7 @@ struct linedisp { unsigned int id; struct timer_list timer; const struct linedisp_ops *ops; + struct linedisp_map *map; char *buf; char *message; unsigned int num_chars; From patchwork Thu Feb 8 18:48:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp494975dyd; Thu, 8 Feb 2024 14:40:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvOAYjKQjyByNG5Tq/NBXTEpk82yb/deHcHsbMWWtDPz0sgKHjolmAlsDKgK/nwqheE/MS X-Received: by 2002:a05:6a20:a11d:b0:19e:48e7:e664 with SMTP id q29-20020a056a20a11d00b0019e48e7e664mr1299590pzk.31.1707432040169; Thu, 08 Feb 2024 14:40:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707432040; cv=pass; d=google.com; s=arc-20160816; b=yB5O3hkoTc5XB9I2qaGW5ralwAOHdMJKvIEvAFobVs1ettEfFHJ7w/Crsv1Df3DgGe GzHybHu4rurgIhJJfc3fCrv6GdPmcVpRQzN6mToHdcZxIVNcd5yCot7CKzDaT9nynhBb Xb82QnZpZXxnJ27gXGlDys/b0IjQ3APJHHTb3iG8MnhQ5rFV5oO8GISLf0m5L2bI4icR 4OlS595LrfH5DFB4qAUZ0P1ZeAz8gS+xh+bGl/5CI/lpY15uEMEo3xDb5SDjAav9uEKp z656Lmoo6lHfClccKAb+9OTHwiWYFNghTyIcE5SIjRF3w1pHtE4/u+kfO+wId5coqCeu Fh/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lX3VHOIPhlq+k1YCWoFTgEsDuMQgnRWseUO0GyrQsg0=; fh=crgj1ix5FP7f4Kha3cZzIYynqPLQgwL7aDWECdiPPQY=; b=Z3gGmSkzSWkAMQ027+QeKcwuUGyqzkcQmmaTgk5IPsh5VwGuvOpdI9fKAceZ/a76MM ltIlKLKoN8c/JdLwouCV1aL/70fpzdDlZvAyXxVAf6Q99vZCzMNm9R8RoCbJOq7Q9Vxh i6sDcrgRBESiEGOjzu5mYwHZ9edvLxBwj0oMiz2Ju+X3sZpp6LsNwgfVTHRuLEv0sHeX g7wn3grAbYnI1G+c5DyhlexvwaLbmQn1fAwkGWLn8wpVMJ+ObozHCJ1ycrHuS2bMv5sL b5ZKJBqy0cgedId8bmoUDeiW+ImMZMIAm0sQi1U3r5JnFOBI2DAozwI/ilgRXzMnoDOF WLXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ma/RGIMH"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58585-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXkslBOAghuiibrekITQswx5vs4s6fN7rg0g+a6FrVrsmtY1iLCzB8P5kl5CggwFdf2QuDQ0SXaFleQ3W4xACk254cxAg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k6-20020a63ba06000000b005cfbea76cf8si582219pgf.42.2024.02.08.14.40.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:40:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58585-ouuuleilei=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="Ma/RGIMH"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58585-ouuuleilei=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 ADF322950AD for ; Thu, 8 Feb 2024 18:58:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3318E5102F; Thu, 8 Feb 2024 18:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ma/RGIMH" 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 865173C481; Thu, 8 Feb 2024 18:49:39 +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=1707418181; cv=none; b=ZTqDOJm6xaurCGKtVNkH5aKTN/Zvyibr+N2PhK30RwFgfP8gZ/hEFgWfdKXKBjubztfwEj/VzxWr4ng/Zm7FPZ0Z9x0aXaijxxkotyoJljjZfbTTmawaaf1hUKwTkVTZFZG8NNEn8LVIbSxagp8pc6KY1j3BdMaDZXY4fsByn9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418181; c=relaxed/simple; bh=T8KmXvh0YgA9eNWvtIJ49Y3WYjlHB5MaL3TkD79lAqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pxCJSZXfgH6/q3R1qlDumce8iT+5E4CX59LB6Pm4m3Sos55kqErTX6eOSP+MzsHG47ibeYChUysWIYUYy6zG6sSq8IKcCM9HI0lafDullG2tNEakZKulDBTWawhMKI3RZAeynxdX3idFBGZ3dTXWkNjkUDXoe1+9MzDr8GyUVaU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ma/RGIMH; arc=none smtp.client-ip=192.198.163.19 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=1707418179; x=1738954179; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T8KmXvh0YgA9eNWvtIJ49Y3WYjlHB5MaL3TkD79lAqw=; b=Ma/RGIMHvJv6U1/NI4+GYuSP+A2np48lLQjbU8D8IOY1Cssf3IN9T2II XBi3SV2XP9RHD7IUZ25LYGfqnqxmr0cf0KaSkWWfWNV4kwvTZVbvlcg2d 9HbGvh/UHc+FSjtcg6NTIY1UGBR+wHaOqQKnLBj+jyNt+hVzSComAZE9o pPyOGc5sirnsA9RYU9p5Vo8g6lES73GN22gn6Io8f1m4snt38f1qXFkpY 9ReV/pEamDS9e/AXqHBKLu969F5KZHOfMB94GDBKlsif1RxDSLHH1ka8D mlXlbABwsmYOYhy3pBnUGL6oaAdwSaBWR46YgcVB1AHo+fAhf90ZlofeT Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186162" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186162" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215538" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215538" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8DDA4F3C; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 10/15] auxdisplay: linedisp: Provide a small buffer in the struct linedisp Date: Thu, 8 Feb 2024 20:48:08 +0200 Message-ID: <20240208184919.2224986-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790372258946724369 X-GMAIL-MSGID: 1790372258946724369 There is a driver that uses small buffer for the string, when we add a new one, we may avoid duplication and use one provided by the line display library. Allow user to skip buffer pointer when registering a device. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/line-display.c | 4 ++-- drivers/auxdisplay/line-display.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index da47fc59f6cb..a3c706e1739d 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -330,8 +330,8 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent, linedisp->dev.parent = parent; linedisp->dev.type = &linedisp_type; linedisp->ops = ops; - linedisp->buf = buf; - linedisp->num_chars = num_chars; + linedisp->buf = buf ? buf : linedisp->curr; + linedisp->num_chars = buf ? num_chars : min(num_chars, LINEDISP_DEFAULT_BUF_SZ); linedisp->scroll_rate = DEFAULT_SCROLL_RATE; err = ida_alloc(&linedisp_id, GFP_KERNEL); diff --git a/drivers/auxdisplay/line-display.h b/drivers/auxdisplay/line-display.h index 65d782111f53..4c354b8f376e 100644 --- a/drivers/auxdisplay/line-display.h +++ b/drivers/auxdisplay/line-display.h @@ -54,12 +54,15 @@ struct linedisp_ops { void (*update)(struct linedisp *linedisp); }; +#define LINEDISP_DEFAULT_BUF_SZ 8u + /** * struct linedisp - character line display private data structure * @dev: the line display device * @id: instance id of this display * @timer: timer used to implement scrolling * @ops: character line display operations + * @curr: fallback buffer for the string * @buf: pointer to the buffer for the string currently displayed * @message: the full message to display or scroll on the display * @num_chars: the number of characters that can be displayed @@ -73,6 +76,7 @@ struct linedisp { struct timer_list timer; const struct linedisp_ops *ops; struct linedisp_map *map; + char curr[LINEDISP_DEFAULT_BUF_SZ]; char *buf; char *message; unsigned int num_chars; From patchwork Thu Feb 8 18:48:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp437408dyd; Thu, 8 Feb 2024 12:35:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHf7M8vZGcEsUYzSd2z82POk49bcNswih2MMx4vhmdUw32MIJZ7QdTm/pR3ajdrlMXHQOk X-Received: by 2002:a05:620a:c16:b0:785:a7fe:c14f with SMTP id l22-20020a05620a0c1600b00785a7fec14fmr685095qki.21.1707424547189; Thu, 08 Feb 2024 12:35:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707424547; cv=pass; d=google.com; s=arc-20160816; b=hYvlHIwShcAP/E2pzWW+TKdxKX3w/W4td8D0gcIG9NXh6bVMY7yBo0EkKkrwQBr3pf P4m64E2xbrc3CBjBEqUFv2eSCPDd7dtqHrHFHtrJIo/DNyDWWJTjKFucf494i5gJWamt QYsEfkDsuiuVzKgjZkP3RaDbY6mRmTtg9eB2Vri0Ub5+4SR0Acgg7M10nUXKmM77ni7m Tc8Ih4gQcLG4cwL35ficX5a0UqcYP/tQwwdg24JeA/7LT+adlOKIhZtHNFvJk6EZj8iO BN9oG2tGx1PdKQSoHp07c+IuPEP8GYSSqnW47Y3epy9JgCBKJ9O5PUxbfN13EsCouqAl IRLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AOqpC7l/E/vfwk/M1hwkJOZablnU70sx8ddiG/mlhW8=; fh=T9Yuu3M6DBhS8mil8Z/yr+vGmz5MX00Ou49laCPBPxw=; b=rZl31bzmV3PP5AUPvtEb8RrkFmukeG2Lm5PFFrpsSSavI7qufJltHkX9VJzI7jg07a qaWwaFg8sCdh0HZUV9b9nhFHV4tn0R9x6qaaCOV369PyRVM1sVkckWViZ9uR+Sbgvb0V O56aAHXYiGXr02UI1C6b7OEmKQVz/du7CtygBXl++OEaFGMHgcLFiIRkxyGQF1PmlFk6 807USSHznNwiDVZx4TxP4LpFaGnRDInbhVCyyxC66SLWFfvl0//lxSgXY2FYuNho/GC+ GpjPG46JAyhaQ7ijJirSI9eFOOGBSEewLEiZSG/pis7YQOkPqi3JhZ2R8Y742QjE73kw wM/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bjm5WjVe; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58583-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXivJ0MtXEE2Xmr1ZZ9dZgmogOkoco/v4pkjmkKUTcRnLebt+cEF9LZeLz+zUlo5zzIGJvYmsTELZPCL3Ae4YTkLRdQVg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b10-20020a05620a088a00b0078593e7df6fsi406271qka.590.2024.02.08.12.35.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:35:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58583-ouuuleilei=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; dkim=pass header.i=@intel.com header.s=Intel header.b=bjm5WjVe; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58583-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DA6801C2A3F3 for ; Thu, 8 Feb 2024 18:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7B1650256; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bjm5WjVe" 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 CC9E5381B1; Thu, 8 Feb 2024 18:49:37 +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=1707418180; cv=none; b=Z9TmrAf0h0tVt41SoNiWEA+cKsi1yhZs+Jw6tZ4pnqZ/nuYiKFV9S80SkWHKTf9VmpLUS4YeqQHAr/cvBOGNUWbwE26SGeZj1RVSxfe+z76eocOdXs+fmUwvwAFDb/PbPnOvB9OHe7u5UwasB5DFXwdrqOWISdjMu0DL1mruA2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418180; c=relaxed/simple; bh=5fFTptxgaNSrb8/J39Uzrc6cETbfYvICnOp+m4GRuCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I6x0ra63uzz6g/QZPWIwmyA9JwK52BkxdNGpQM/9JW32ijPWn1oxKXTNPB0S7f/nfvsz+CDOQybjySU74N1mhxqtF3Eip2egk/2RRwsU+mDaDHuClkmA1niyqUG9xdCHD6Cit1XVUbEpVS29M57oIxcOhjpplwMgwChULPqy9eg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bjm5WjVe; arc=none smtp.client-ip=192.198.163.19 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=1707418178; x=1738954178; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5fFTptxgaNSrb8/J39Uzrc6cETbfYvICnOp+m4GRuCg=; b=bjm5WjVesqNwJwuCMUWtLhfJ7HWddeJ7PTrzZApt1GjCW3drJASlUYX6 3S+Yni2MQcLVpDer7WTqCdJ11B/DmeiFSwtvAXaC2W01Q+q0oKc6ZWIJm F9SCooJTKAM4RZRvOaC5eCWl4nB0eEWLCMNyxYyeeScMw/IlYFoSYDa1z +9xOARo4DQ5lI1w4kC7RwA4QHUO+IF0hBA8dCsrCA5lq9S8yTC7h52JgI PJuU1pqqkhbhV85EdbUczUVo+0J45f9e0N1JwjLmrUBClxyrFxtZISBsM gDChrU/kgU64LbH6yUXkSHdg9f0iJG9Nc3oW6TkVlDUYCfNf9lVBR2QXi g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186157" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186157" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215537" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215537" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9306DE1; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 11/15] auxdisplay: ht16k33: Move ht16k33_linedisp_ops down Date: Thu, 8 Feb 2024 20:48:09 +0200 Message-ID: <20240208184919.2224986-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790364401985724707 X-GMAIL-MSGID: 1790364401985724707 We will need the update functions to be defined before ht16k33_linedisp_ops. Move the latter down in the code. No functional change intended. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/ht16k33.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index 0cdf3fbdf81e..75c4a8d31642 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -440,18 +440,6 @@ static void ht16k33_keypad_stop(struct input_dev *dev) disable_irq(keypad->client->irq); } -static void ht16k33_linedisp_update(struct linedisp *linedisp) -{ - struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, - seg.linedisp); - - schedule_delayed_work(&priv->work, 0); -} - -static const struct linedisp_ops ht16k33_linedisp_ops = { - .update = ht16k33_linedisp_update, -}; - static void ht16k33_seg7_update(struct work_struct *work) { struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv, @@ -489,6 +477,18 @@ static void ht16k33_seg14_update(struct work_struct *work) i2c_smbus_write_i2c_block_data(priv->client, 0, ARRAY_SIZE(buf), buf); } +static void ht16k33_linedisp_update(struct linedisp *linedisp) +{ + struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, + seg.linedisp); + + schedule_delayed_work(&priv->work, 0); +} + +static const struct linedisp_ops ht16k33_linedisp_ops = { + .update = ht16k33_linedisp_update, +}; + static int ht16k33_led_probe(struct device *dev, struct led_classdev *led, unsigned int brightness) { From patchwork Thu Feb 8 18:48:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp512437dyd; Thu, 8 Feb 2024 15:21:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXIWhqow+Yxzr6zvbXVexiNoywj8dSZ3En/79LFlnvMqncIjy0buBZBu8RIsSsknP9qjkNR2qXT9+5e1zPDwsJuOJlzCw== X-Google-Smtp-Source: AGHT+IGyu7nlLFZKyvzYwVHQ47E7hgBqHOH2YwAWRCFIV9Q0RQJY/hLKyB0TwDjAk9xEH6WXp2wp X-Received: by 2002:a05:6a00:c94:b0:6e0:3789:1d22 with SMTP id a20-20020a056a000c9400b006e037891d22mr9866pfv.0.1707434464616; Thu, 08 Feb 2024 15:21:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707434464; cv=pass; d=google.com; s=arc-20160816; b=pCzs7NmET4LsWMrWmUDOmnkYOvryRUSKtPcz4V0bS+G0naMwWMpwQH71R1ynA84jRE d74OqDt4XDvFWhKJwnKFVto+7I4rqH2y3ZzovNy2e4kqInklWuWP0oC1o8nAkuHPo3Cf YpV5vXG9oMK8qRveiy3Vzy1UEcrTQ4rpLzsa44Nqs/BCfRtVFQHcBj/lWo7FrF7VZuHf XreBhRD4V4eaD2m8TXNRNcA3YauqFPgD+GJLx4RDfZE7ers+bp1+qo95y74Y+48WRx2v gWSLOUlDGxmZFvk/8Z5GRZVPAMLn762o5F90xOYGBR0IN9t4Tuuj8FEdZP4vZ9AAOJHM ieyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BZZ9COAo9J+xTYO7TNwEq0ABAvcWnGlV4DRu2yTgvbc=; fh=NDNheVrj2og7vOKO5wl9p35F5MaYz/aF4l+Nm1dChO4=; b=dWH/VMT+XNoMqZVe8FG2+AHORFXXBNpCrA3rYWIIuJH1POM5aTf6Z8/vnvNXTTd2g+ w3Bau1LtapwAjQuJvnPLU8Fakyh0qZTcmaiPtRAsUwV3truvRIAj8saBzqT6sk2oqT4R yzCI6Q1m5zswNrr50FAgXupfzWGBTC7ORqltLhOzScrkPnrZ400hd1+7ZOR2DKQ4EKPI KimFZRuJSGxWXA+Ju3GW3/B5VPxLKqvyZnJoU/JMs15GrYR7uyN0tX0FEA0QzCLcCyIH pjiGvd74Y9a68YwmAqZWVjwhHjZSbbJBONnqsC77EoOBO3flDP0LXumQiCVUqBWbdX4X a5PQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=juptwNZH; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58582-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58582-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWSR1npk8kmYgBrHJvnmenRGegvqAS/rbnh6pqELI8FuK9KVpDO3B6eIz8C/TuvWoFR+ssthws7jmKlHHDiKRf9WvaqZw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id g1-20020a056a000b8100b006e02aba7478si466880pfj.396.2024.02.08.15.21.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:21:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58582-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=juptwNZH; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58582-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58582-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1CD8CB2B8A2 for ; Thu, 8 Feb 2024 18:58:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A508950A93; Thu, 8 Feb 2024 18:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="juptwNZH" 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 F220B364A5; Thu, 8 Feb 2024 18:49:33 +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=1707418179; cv=none; b=VQACZ2k3/xuXYl4SclvmKNJ0EKL98Hhq23ZOcNyowt81lQgnxsg1q34scxjv+n/eiuRXnRcxHWSIOnRST4oRKf6o9Kl5qkA+5WVGcuUKk2bi0zi5vNe9VHCschTDBqC3Q2bVFpaB2gm7AeFZZuoii67QLXrq2asfuLCEwetQXsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418179; c=relaxed/simple; bh=xY52GBdbWlUZAfmSG2absg3scItgooHoNN72W48Llrw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g7JXTSTs7mKWx/G2XiEvpFz5K+t1e2/dOwASCoXONnyXypwQUJw7D2v3azUpIFCHZRaukCKhDY04bMMDBZjPNJ84zPdxIqiygpOM0gQI4Pdja0qpRFkRHK+gZOJN7y41DV5+A19qCJbm7vAHVRVGEu0GH4k5PoKrDbCCbEO1rUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=juptwNZH; arc=none smtp.client-ip=192.198.163.19 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=1707418174; x=1738954174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xY52GBdbWlUZAfmSG2absg3scItgooHoNN72W48Llrw=; b=juptwNZH2fQxy9z/+VkHzyhPXxQ0fqx9xxjARYgTLx82ymngkVIB+7n7 IDznOe1l9HMoqb89DTAXL0yyntY0S0mzLRkaXvmxgc67srbTL7WPx5URh EF1x1bc+lkgbUEI5y7h7j3tMj/NyjLZEFA+TL5QqsfeY//MQk+f68bKRW nO3yl8+nXROR1WeQKKS+eYHPib+XsyM9LoBrAqmaaDgxwf9wA+GY9R6Wd uZdVaaYUCCv4O4eiu6w3bO2FT9Wl8TsqntWNrPLn1wlzrFP79pCTV0gmN 13dosrdYdozj+yOpOnNcBJEn/e1ePzUcV29BQB8qc5PJ6uMcb8sUDL2Vj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186145" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186145" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215539" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215539" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A22571027; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 12/15] auxdisplay: ht16k33: Switch to use line display character mapping Date: Thu, 8 Feb 2024 20:48:10 +0200 Message-ID: <20240208184919.2224986-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790374801014658456 X-GMAIL-MSGID: 1790374801014658456 Since line display library supports necessary bits to map the characters (if required), switch this driver to use that. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/ht16k33.c | 109 +++++++++++------------------------ 1 file changed, 34 insertions(+), 75 deletions(-) diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index 75c4a8d31642..b104f08252dd 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -87,11 +87,6 @@ struct ht16k33_fbdev { struct ht16k33_seg { struct linedisp linedisp; - union { - struct seg7_conversion_map seg7; - struct seg14_conversion_map seg14; - } map; - unsigned int map_size; char curr[4]; }; @@ -135,33 +130,6 @@ static const struct fb_var_screeninfo ht16k33_fb_var = { .vmode = FB_VMODE_NONINTERLACED, }; -static const SEG7_DEFAULT_MAP(initial_map_seg7); -static const SEG14_DEFAULT_MAP(initial_map_seg14); - -static ssize_t map_seg_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct ht16k33_priv *priv = dev_get_drvdata(dev); - - memcpy(buf, &priv->seg.map, priv->seg.map_size); - return priv->seg.map_size; -} - -static ssize_t map_seg_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t cnt) -{ - struct ht16k33_priv *priv = dev_get_drvdata(dev); - - if (cnt != priv->seg.map_size) - return -EINVAL; - - memcpy(&priv->seg.map, buf, cnt); - return cnt; -} - -static DEVICE_ATTR(map_seg7, 0644, map_seg_show, map_seg_store); -static DEVICE_ATTR(map_seg14, 0644, map_seg_show, map_seg_store); - static int ht16k33_display_on(struct ht16k33_priv *priv) { uint8_t data = REG_DISPLAY_SETUP | REG_DISPLAY_SETUP_ON | priv->blink; @@ -445,18 +413,20 @@ static void ht16k33_seg7_update(struct work_struct *work) struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv, work.work); struct ht16k33_seg *seg = &priv->seg; + struct linedisp *linedisp = &seg->linedisp; + struct linedisp_map *map = linedisp->map; char *s = seg->curr; uint8_t buf[9]; - buf[0] = map_to_seg7(&seg->map.seg7, *s++); + buf[0] = map_to_seg7(&map->map.seg7, *s++); buf[1] = 0; - buf[2] = map_to_seg7(&seg->map.seg7, *s++); + buf[2] = map_to_seg7(&map->map.seg7, *s++); buf[3] = 0; buf[4] = 0; buf[5] = 0; - buf[6] = map_to_seg7(&seg->map.seg7, *s++); + buf[6] = map_to_seg7(&map->map.seg7, *s++); buf[7] = 0; - buf[8] = map_to_seg7(&seg->map.seg7, *s++); + buf[8] = map_to_seg7(&map->map.seg7, *s++); i2c_smbus_write_i2c_block_data(priv->client, 0, ARRAY_SIZE(buf), buf); } @@ -466,17 +436,39 @@ static void ht16k33_seg14_update(struct work_struct *work) struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv, work.work); struct ht16k33_seg *seg = &priv->seg; + struct linedisp *linedisp = &seg->linedisp; + struct linedisp_map *map = linedisp->map; char *s = seg->curr; uint8_t buf[8]; - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf); - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf + 2); - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf + 4); - put_unaligned_le16(map_to_seg14(&seg->map.seg14, *s++), buf + 6); + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 0); + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 2); + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 4); + put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 6); i2c_smbus_write_i2c_block_data(priv->client, 0, ARRAY_SIZE(buf), buf); } +static int ht16k33_linedisp_get_map_type(struct linedisp *linedisp) +{ + struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, + seg.linedisp); + + switch (priv->type) { + case DISP_MATRIX: + /* not handled here */ + return -EINVAL; + + case DISP_QUAD_7SEG: + INIT_DELAYED_WORK(&priv->work, ht16k33_seg7_update); + return LINEDISP_MAP_SEG7; + + case DISP_QUAD_14SEG: + INIT_DELAYED_WORK(&priv->work, ht16k33_seg14_update); + return LINEDISP_MAP_SEG14; + } +} + static void ht16k33_linedisp_update(struct linedisp *linedisp) { struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, @@ -486,6 +478,7 @@ static void ht16k33_linedisp_update(struct linedisp *linedisp) } static const struct linedisp_ops ht16k33_linedisp_ops = { + .get_map_type = ht16k33_linedisp_get_map_type, .update = ht16k33_linedisp_update, }; @@ -677,39 +670,7 @@ static int ht16k33_seg_probe(struct device *dev, struct ht16k33_priv *priv, if (err) return err; - switch (priv->type) { - case DISP_MATRIX: - /* not handled here */ - err = -EINVAL; - break; - - case DISP_QUAD_7SEG: - INIT_DELAYED_WORK(&priv->work, ht16k33_seg7_update); - seg->map.seg7 = initial_map_seg7; - seg->map_size = sizeof(seg->map.seg7); - err = device_create_file(dev, &dev_attr_map_seg7); - break; - - case DISP_QUAD_14SEG: - INIT_DELAYED_WORK(&priv->work, ht16k33_seg14_update); - seg->map.seg14 = initial_map_seg14; - seg->map_size = sizeof(seg->map.seg14); - err = device_create_file(dev, &dev_attr_map_seg14); - break; - } - if (err) - return err; - - err = linedisp_register(&seg->linedisp, dev, 4, seg->curr, &ht16k33_linedisp_ops); - if (err) - goto err_remove_map_file; - - return 0; - -err_remove_map_file: - device_remove_file(dev, &dev_attr_map_seg7); - device_remove_file(dev, &dev_attr_map_seg14); - return err; + return linedisp_register(&seg->linedisp, dev, 4, seg->curr, &ht16k33_linedisp_ops); } static int ht16k33_probe(struct i2c_client *client) @@ -794,8 +755,6 @@ static void ht16k33_remove(struct i2c_client *client) case DISP_QUAD_7SEG: case DISP_QUAD_14SEG: linedisp_unregister(&priv->seg.linedisp); - device_remove_file(&client->dev, &dev_attr_map_seg7); - device_remove_file(&client->dev, &dev_attr_map_seg14); break; } } From patchwork Thu Feb 8 18:48:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp451003dyd; Thu, 8 Feb 2024 13:04:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVoEmrZsYZna/rHLpAmoJ1soMj11YvLARq7L+Oz4Jb1v8zTfFif0PM/6NBBDu+qILxAf4whC+lo0oP7GmV7svRYmaPZNg== X-Google-Smtp-Source: AGHT+IG54RefotwQRcLG2FqjSQFVDj9ZRDJtcU74eeafdWs/d2l1MNt6qdOBCspsVJuSFteLGcFl X-Received: by 2002:a17:90b:19d2:b0:296:19ec:1df6 with SMTP id nm18-20020a17090b19d200b0029619ec1df6mr413751pjb.33.1707426272946; Thu, 08 Feb 2024 13:04:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707426272; cv=pass; d=google.com; s=arc-20160816; b=YjNQSBX9hVbLW6WwmZ+sw0WMUa5Wew8gbM5Q9Vai7sSfV/61wUIoyz9wiPry8y0A+X FN6CasAXi/z5LegOAKEu9qPw8NB6nnzBDS/MgpSOb8C7tUQsmenq6BqMH2EG2IHqXBps mBvPWeHdNks40FUOOB+3G5cfaASneCYhQIjMcbnvAC5WMEYaZDSdveQ76uGizwdycPpH 8jJki2EXQG6low1UwUI+IFBmpj3zsLglj9v4UKGQvcyIBeDTEjsfGCs1ZW2qWQz33oV0 oxlhLtD4BU6kNto05kP/tifoTOmi30xUHZsKdOMC5dbRTGl1wpUqQFCVDy200PUso7uW qaaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7M72bWwTNzcNuG2Rbo+yBdwaFcyGSuxvbkFx7bP710M=; fh=PAZQr8ytMQLW6rs0iQ2E45kD05RWfTOPUQx5j8gPeJg=; b=UkDQBhomnRT0j7yjtWivD6KiAFZ/5Xe0qRycICmj1P8OFfyZ4chFHloW1nsDKkbD0m M5XcNjtrauYGMhO7dHF5yMw66p3px+p+8SYQ9dL6QInofWyrY8h9UZLkBrR7Z/zJG3zO O30LU3gF2i1+RmMDLKvKTxIJChi97LkDUoH1cQTb99HX/7ohVEcukrl8HX+P4IW97UIN KBgFr05ATEIeXXIsfVL1UB8/VJ/ZTaypyywUqnZhLkx6ZEvUBcOlpGzcf/l1KI9wWWuA CdzWp7zp6m24GUrQL++FNatJPdOPjZF7OEtRCYO4++Gs8mc5a9BNQApf8trMmEYq6dmR PIJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=h6Dh9ahQ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58584-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58584-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCUht4fcgjZJSQEfW/mBl809AXz4/tb07u3TGFLYMT8RCU2PYS2IMVXw7cE5COOjf8HPUOU1WkCh8A7z97OWWKGSHLF1zQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z16-20020a170902d55000b001d9f4da0c21si395477plf.120.2024.02.08.13.04.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:04:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58584-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=h6Dh9ahQ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58584-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58584-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0646DB2B9EA for ; Thu, 8 Feb 2024 18:58:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 606B25103A; Thu, 8 Feb 2024 18:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="h6Dh9ahQ" 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 ACAF7383B8; Thu, 8 Feb 2024 18:49:38 +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=1707418181; cv=none; b=NHmZMaeCGqo+6NRxYsyvYiBgVVKb8Y3W4BW2UhUBsFoSIEqf1UUTIX9EHQckgioxRX47mtahgUxWRT/Q8Qe4Ku9W0RKvTIRjwSJ95zbjSZJmRhv9MgmtuWi5AoOZ3T+crN1RIzC41/5kKHvO2L7gUtW+tnoScJmAsb2wKslcI3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418181; c=relaxed/simple; bh=FH8g0LViq9a54GUNHUMfITSFf708fBC8temf69sHlcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i6SjRyrNyNpZ0Xus86ygZizkbbHHqp/eUUAvomUBT9OavnXCe3PBkU05f+rxN2+WgnKp2PfoeyH+FD3eyKRasTX24En2crQZK88CgjcsViZ++tNMGr79OAAutpzGeSSaxCBjWaP6IkXCYZRKuPen71b1ts0n2/H9RQND1E1XaSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=h6Dh9ahQ; arc=none smtp.client-ip=192.198.163.19 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=1707418179; x=1738954179; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FH8g0LViq9a54GUNHUMfITSFf708fBC8temf69sHlcE=; b=h6Dh9ahQP+rCEf+4jUtz0ewl+O6oqSwcustfIP0OfKv409rJSY2/WEMV wSwl1ktHrg2UCt7yLoBYqhdIKCkMcz4a9ZsKx6F7qtR1fpob8AtIslzt5 EYJDVdzhlhMIrpkKXp7NVDNZAR1fQvUhFZu2cm68cpi4nr3+wpzbRDPeh Z3db5VfAHGBBwVV9Ut1wCJpj5VBUk7G6pSr/EZuTC/jiHrjTJci2RU7Sw rIWY52bLD7WxuIDHrCE5yBUDdqvQKkfNkledkqFdqIFxN6kraB8R47SOa xrhVECBYRWifZW4TJ4bMZ3zXOy47ahlmGLYKzbPEWnxFz2tN9gL6+T9vR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186152" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186152" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215541" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215541" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id AC41CF4D; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 13/15] auxdisplay: ht16k33: Use buffer from struct linedisp Date: Thu, 8 Feb 2024 20:48:11 +0200 Message-ID: <20240208184919.2224986-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790366211579924974 X-GMAIL-MSGID: 1790366211579924974 struct linedips embedds a small buffer for the string that we may reuse. Update the driver accordingly. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/ht16k33.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index b104f08252dd..08cc05b9d216 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -85,11 +85,6 @@ struct ht16k33_fbdev { uint8_t *cache; }; -struct ht16k33_seg { - struct linedisp linedisp; - char curr[4]; -}; - struct ht16k33_priv { struct i2c_client *client; struct delayed_work work; @@ -97,7 +92,7 @@ struct ht16k33_priv { struct ht16k33_keypad keypad; union { struct ht16k33_fbdev fbdev; - struct ht16k33_seg seg; + struct linedisp linedisp; }; enum display_type type; uint8_t blink; @@ -412,10 +407,9 @@ static void ht16k33_seg7_update(struct work_struct *work) { struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv, work.work); - struct ht16k33_seg *seg = &priv->seg; - struct linedisp *linedisp = &seg->linedisp; + struct linedisp *linedisp = &priv->linedisp; struct linedisp_map *map = linedisp->map; - char *s = seg->curr; + char *s = linedisp->curr; uint8_t buf[9]; buf[0] = map_to_seg7(&map->map.seg7, *s++); @@ -435,10 +429,9 @@ static void ht16k33_seg14_update(struct work_struct *work) { struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv, work.work); - struct ht16k33_seg *seg = &priv->seg; - struct linedisp *linedisp = &seg->linedisp; + struct linedisp *linedisp = &priv->linedisp; struct linedisp_map *map = linedisp->map; - char *s = seg->curr; + char *s = linedisp->curr; uint8_t buf[8]; put_unaligned_le16(map_to_seg14(&map->map.seg14, *s++), buf + 0); @@ -451,8 +444,7 @@ static void ht16k33_seg14_update(struct work_struct *work) static int ht16k33_linedisp_get_map_type(struct linedisp *linedisp) { - struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, - seg.linedisp); + struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, linedisp); switch (priv->type) { case DISP_MATRIX: @@ -471,8 +463,7 @@ static int ht16k33_linedisp_get_map_type(struct linedisp *linedisp) static void ht16k33_linedisp_update(struct linedisp *linedisp) { - struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, - seg.linedisp); + struct ht16k33_priv *priv = container_of(linedisp, struct ht16k33_priv, linedisp); schedule_delayed_work(&priv->work, 0); } @@ -663,14 +654,13 @@ static int ht16k33_fbdev_probe(struct device *dev, struct ht16k33_priv *priv, static int ht16k33_seg_probe(struct device *dev, struct ht16k33_priv *priv, uint32_t brightness) { - struct ht16k33_seg *seg = &priv->seg; int err; err = ht16k33_brightness_set(priv, brightness); if (err) return err; - return linedisp_register(&seg->linedisp, dev, 4, seg->curr, &ht16k33_linedisp_ops); + return linedisp_register(&priv->linedisp, dev, 4, NULL, &ht16k33_linedisp_ops); } static int ht16k33_probe(struct i2c_client *client) @@ -754,7 +744,7 @@ static void ht16k33_remove(struct i2c_client *client) case DISP_QUAD_7SEG: case DISP_QUAD_14SEG: - linedisp_unregister(&priv->seg.linedisp); + linedisp_unregister(&priv->linedisp); break; } } From patchwork Thu Feb 8 18:48:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp414171dyd; Thu, 8 Feb 2024 11:51:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX7qYSmzCRwJpBYciRF/Ub+PJS7i8iqsT+/QZJhYSNzYGQY4aWzPKmoZ8hB7YFIcLraItBxp9PEmNI5LqH2AWGTz1Uy9w== X-Google-Smtp-Source: AGHT+IGCJ7b/3aJSFyD4FGCLGKNYIQhQiFWdp+CPBeXaUI9GV+oUjMiSdnMxx5TWeOjS6VQw6JZw X-Received: by 2002:aca:190d:0:b0:3bf:f066:ca0f with SMTP id l13-20020aca190d000000b003bff066ca0fmr333825oii.46.1707421864357; Thu, 08 Feb 2024 11:51:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707421864; cv=pass; d=google.com; s=arc-20160816; b=TfDEEujWk0t0FsIwfJO/KPJcsNSnQ3in9hH35bQmEe+/zAo8ZyWGqD9PyL+TJXqGeu DFkpa/xeowJua1RMOf7tIzW+3KZfuEhZPrHoctr4GWGeRvdXV9Zk958ilJeP1F+uClC6 yxexnVAs+FVNcwWMCEptg1Xw+pHBkLY0czdt/k0Y/cLe4drrzVRXHISIAZ36ehKGwZOW 43NUWrdCRLxCVl7IfntJasTa911Ppt03qye3bKz9wrAZhxOXFR0hAV35pNCgTB3CCNck er1fBCgV7ByaluAa7BJzQieLKE/RXqBZCm1jrwhgSt+KGemf8XhXTAzdM2gZ0yPliEiQ zYxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=o8OW6rgAVY/+qAoGwDGdOof0EXHfbB3/JF/gcW3+PdA=; fh=SkOM/TsZCxCboFTDDLY36ln3DDd99x1Ivnh/2nwHtXY=; b=JmVB6r/XjCIdedF+rQkKouUdpeINm1czk+syDSHygvmLPPMtjWrHD0SH7wwNikefHJ jBWQRiUJehBPHK3xFxOee6T/hp0+2vsPDAZMfrtQNzmJmWFJP8UioxjMKXvuUDBS5J0O Id2kCL1N51EqR6loDbQw3R4GQMIpgW2sFszQ3TFo4dq09l1LEKpf3SaNcCbgSemQDF3/ +jrd2AiyVZWprFnuFcGYrzmCULwEWJZwnPv2dwgql73h6zRiruJC/0CPFilPRcQ5xa5Z KcqZ5QBTLb6ZzscNV8Dyx3+PnKI+crOecE5CSP73FBg+RzCpbjTqp2G6yV8dv9ZGHAdp nDxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KPpVkpOw; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58574-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58574-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVshLtcqfdC72OHAFi3HdfRtiVVDvKXDQggxgRtZqBuWMSpuUHAarh5v9Bq+e/6ABFm8JuFNy9qr+arBex2h9fGKguJng== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o18-20020a05622a045200b0042c2812fa40si163295qtx.757.2024.02.08.11.51.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:51:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58574-ouuuleilei=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; dkim=pass header.i=@intel.com header.s=Intel header.b=KPpVkpOw; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58574-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58574-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 15EE71C29BA8 for ; Thu, 8 Feb 2024 18:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB3A54F5FA; Thu, 8 Feb 2024 18:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KPpVkpOw" 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 CDB1B36AE1; Thu, 8 Feb 2024 18:49:34 +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=1707418177; cv=none; b=Yt4z4mqEwKZOENMev72htaE3ycuKJaGyZqz+t6rqM1hufnEE1dCDPW8vHhAEjXirdN8TQ0eJINkLoJQoPBCmJ86ieIYEe0V3q4n0GAFnINUICT0u55021fpLlXnTTKTo89q8Xwbg7chikdZhC+rfdWAeKfhK5NS/yq6ViJK0QTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418177; c=relaxed/simple; bh=xwQv8uq+9wANm7Kp3tnfC+qRvpRyTa5vpEt37Og3eA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NmtedN/pFCbYVpQKWQkl/hlMakijeAK80rLrX9goH1Deu7FXp6DdqpGY5fb2c1KeL+f4iaRU5N72dD54qHflPWd8K3yUPxQnQt3yGps4D4SRbdzwxQTJIBOyP9br82FN3xxKP+x9hg+ghXY0OsByMsS7xuF8krg77D3WSwntwpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KPpVkpOw; arc=none smtp.client-ip=192.198.163.19 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=1707418175; x=1738954175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xwQv8uq+9wANm7Kp3tnfC+qRvpRyTa5vpEt37Og3eA0=; b=KPpVkpOwmpcbJaEuStBBJXt9pcDyw0Yp21ENfTOk3WWVq0SuxU1K9G0+ 694OQtFllPE+ThKBqsS+dqOuZGZTi+Nt1s+hOVi/yCA5ZXjj0s4Xd+dJo /8gpsSpXXGmOY0ONR+q1WypL+1mJO9J70UrMvsWMzjj1bhND6+uk3WfHU ur2qQwGbR3JxHg567nzcRNqdwb3jjgNg1tIjDHNW+FBorwuLoSWtnkW8I oqwVFS/PbVyZoSs1O/uY0CaggrCsegxSf2OchqwGKBwVFHcHFfxdx5eH2 455QXbR7NIGFQE3Q09iWlV1GzxyrvuA/y/wcZL09mEHoXwDvVRb6xIJpT g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186141" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186141" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215540" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215540" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id BBA6112FC; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 14/15] dt-bindings: auxdisplay: Add Maxim MAX6958/6959 Date: Thu, 8 Feb 2024 20:48:12 +0200 Message-ID: <20240208184919.2224986-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790361588468974540 X-GMAIL-MSGID: 1790361588468974540 Add initial device tree documentation for Maxim MAX6958/6959. Signed-off-by: Andy Shevchenko --- .../bindings/auxdisplay/maxim,max6959.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml diff --git a/Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml b/Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml new file mode 100644 index 000000000000..49ce26176797 --- /dev/null +++ b/Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/auxdisplay/maxim,max6959.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MAX6958/6959 7-segment LED display controller with keyscan + +maintainers: + - Andy Shevchenko + +properties: + compatible: + const: maxim,max6959 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + max6959: max6959@38 { + compatible = "maxim,max6959"; + reg = <0x38>; + }; + }; From patchwork Thu Feb 8 18:48:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp454670dyd; Thu, 8 Feb 2024 13:10:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4TQRaIr9avZbWx0pdlDh2FuUyx5pyYTWWqSGi09IZKQMzeTz976In03IKMxKVAAa4wbVN X-Received: by 2002:a05:6a20:a31b:b0:19e:43cd:9a2b with SMTP id x27-20020a056a20a31b00b0019e43cd9a2bmr729366pzk.34.1707426654445; Thu, 08 Feb 2024 13:10:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707426654; cv=pass; d=google.com; s=arc-20160816; b=C4ciqX6/9PKSH2AbS4BF7rQE80VPwZkVkXjO6+JQUxwv6MVW7/5z7K57UICLl8PbsF 4XeHubUWLzEZx+mTSC+p/p+aYOLo13m6eGVBnXauJahu7mVO7jP9y1PlS3lkN/KnQ13a pfFUt0Q1ZPZLxQBLzPeGtco49d9YfR99IsG3fita8xg3xYRiI75XlQjJ4Ts/r6+Aek8B WhjpEDecLldxd6Zdf7sDCf87OHL0sGK09t7jpDto6obGR2Rb4ofHKJYRVcMkGSVY+k1i wtO6wysM4//iOAuzenjmudVz+4j4KLCZBFUgYu1/qBQxtApzgGUJ17wDkfec5hK3XEQr Z58Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ojqTO3E66DUCSAWMIubR9VbnWsZBCLfxTp29avZLBn0=; fh=FORgB8wbdq3B8KmffO2AbqGUr1o0dj4d8+yqq2bBDGY=; b=GszdhODNhl8isCKhDjfSPkCTjQC/7tbGDwgx0dp9rf9AhgDeJ+Jp7W4Gbwpwi2+rVJ roxAd/fAVFemfOmb7qxQyi8U+KKojCzSTlS1BvsF1GXLfVb1KgHvYY1AdaMKaxsscZow ZTfKdWXxDNP+7AqJ4cXkmhrCc2PoTzDHkMPRZMrFWEsk7nS7a9+lbMJ2uQhFDfKrXn6i /rqWy4YVAcOOFyFqGch7a6yQ9OSyggfsSv11+LLlyK35FvM/QcCtnbBeRS89mcDoyoZq ml3JQy2xdxj0ateY6dOIjElRjHxmZFjGNvDNQ7+yAoB7+HRO+OJ+ToIRmlv6i6Ybq9EG BluQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LIFY9hXr; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58586-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58586-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWNOoFlWtXAJ7qiJoFuJ02Y7L9XgtiHD/ivZJGJDwvoWifV9pOwR6jbW0juMM2w2tnrVmm/8bmV/wJBf5a3vzdcYtM/dg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ck26-20020a056a02091a00b005cdbf06a032si430604pgb.716.2024.02.08.13.10.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:10:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58586-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LIFY9hXr; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58586-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58586-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3B084B2BA8E for ; Thu, 8 Feb 2024 18:58:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C6A851C3D; Thu, 8 Feb 2024 18:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LIFY9hXr" 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 467AE3F9DF; Thu, 8 Feb 2024 18:49:40 +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=1707418182; cv=none; b=TZqOtM/ZLUya46DgOmyKHth9nHNSw3XgKjVUL1uVaEU3yLNNR7L81X/S44e/4MHJ1p7dZycbqlvegwYuLMYcSf5GyByJb269NsdBRk6GAuAkiZiq49R/xHhDGUsGzpsuLfadhg6Hz9LHmSuV8L8Zp/p4pjOAiaRycYmFhldruGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418182; c=relaxed/simple; bh=v6wTWOcgnBbdVRVq0vTx2zi8kxA67Ld9K3m1TKyiM1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tZcl5XkVj8K/XqmtFayXVE9qsKH7n9505Sh2QQCrQZQ1C91Hu+6tPeDqK23i9eUT+CS4ddYVd1VjXk44MAdq9D/zJcqRIEISiQw+ZXXYJqErZ8AKMHs6vU7Uv8anSnqG665zkbYC+fDzxmHzCg3h4WxAFbd68kPDteS7uOdrIVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LIFY9hXr; arc=none smtp.client-ip=192.198.163.19 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=1707418180; x=1738954180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v6wTWOcgnBbdVRVq0vTx2zi8kxA67Ld9K3m1TKyiM1Q=; b=LIFY9hXr4ZonEoYdzXaF1hVI877SOcxjlIxB/T+8ia+89IBz7IknZpUk EAzT3+qkQc9l+YvqwFtGH52wBxRYakg6Pw3l1BW9qkK5PEiMdfuET/F9T oOo9j57L0J33KbgfKL4SQJBR+O+GTFqXSqDhp01SY47MZpg38uVFzif72 l0eRXX6H6TVE3Ea4lT77YWobMmOdxD1qPKXecbxzaprLcW/ixFMLGLPMO 6VZ26U6MLjF0JfxRw5a0Es3u4zfOEBGzRmMBf594gb5Yf10rBp60pYQeq aSevGCP4S+/W6LBIFKtPyC9ksgSPd0mSVASzcjJLl9mmJ2Mrqf/BCCJS3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1186177" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1186177" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:49:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934215554" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934215554" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:49:29 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C14AE1043; Thu, 8 Feb 2024 20:49:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton , Geert Uytterhoeven Subject: [PATCH v1 15/15] auxdisplay: Add driver for MAX695x 7-segment LED controllers Date: Thu, 8 Feb 2024 20:48:13 +0200 Message-ID: <20240208184919.2224986-16-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> References: <20240208184919.2224986-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790366611462707618 X-GMAIL-MSGID: 1790366611462707618 Add initial driver for the MAX6958 and MAX6959 7-segment LED controllers. Signed-off-by: Andy Shevchenko --- drivers/auxdisplay/Kconfig | 14 +++ drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/max6959.c | 200 +++++++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 drivers/auxdisplay/max6959.c diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index a34a9a52158f..079d58bb0293 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig @@ -187,6 +187,20 @@ config HT16K33 Say yes here to add support for Holtek HT16K33, RAM mapping 16*8 LED controller driver with keyscan. +config MAX6959 + tristate "Maxim MAX6958/6959 7-segment LED controller with keyscan" + depends on I2C + select REGMAP_I2C + select LINEDISP + help + If you say yes here you get support for the following Maxim chips + (I2C 7-segment LED display controller with keyscan): + - MAX6958 + - MAX6959 (debounce support) + + This driver can also be built as a module. If so, the module + will be called max6959. + config ARM_CHARLCD bool "ARM Ltd. Character LCD Driver" depends on PLAT_VERSATILE diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile index 43bad850481c..f62a258809ef 100644 --- a/drivers/auxdisplay/Makefile +++ b/drivers/auxdisplay/Makefile @@ -12,5 +12,6 @@ obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o obj-$(CONFIG_LINEDISP) += line-display.o obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o obj-$(CONFIG_HT16K33) += ht16k33.o +obj-$(CONFIG_MAX6959) += max6959.o obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o obj-$(CONFIG_PARPORT_PANEL) += panel.o diff --git a/drivers/auxdisplay/max6959.c b/drivers/auxdisplay/max6959.c new file mode 100644 index 000000000000..0c5cbd16c3fe --- /dev/null +++ b/drivers/auxdisplay/max6959.c @@ -0,0 +1,200 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * MAX6958/6959 7-segment LED display controller with keyscan + * Datasheet: + * https://www.analog.com/media/en/technical-documentation/data-sheets/MAX6958-MAX6959.pdf + * + * Copyright (c) 2024, Intel Corporation. + * Author: Andy Shevchenko + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "line-display.h" + +/* Registers */ +#define REG_DECODE_MODE 0x01 +#define REG_INTENSITY 0x02 +#define REG_SCAN_LIMIT 0x03 +#define REG_CONFIGURATION 0x04 +#define REG_CONFIGURATION_S_BIT BIT(0) + +#define REG_DIGIT(x) (0x20 + (x)) +#define REG_DIGIT0 0x20 +#define REG_DIGIT1 0x21 +#define REG_DIGIT2 0x22 +#define REG_DIGIT3 0x23 + +#define REG_SEGMENTS 0x24 +#define REG_MAX REG_SEGMENTS + +/* Defines */ +#define MIN_BRIGHTNESS 0x01 +#define MAX_BRIGHTNESS 0x40 + +struct max6959_priv { + struct linedisp linedisp; + + struct delayed_work work; + + struct regmap *regmap; +}; + +static void max6959_disp_update(struct work_struct *work) +{ + struct max6959_priv *priv = container_of(work, struct max6959_priv, work.work); + struct linedisp *linedisp = &priv->linedisp; + struct linedisp_map *map = linedisp->map; + char *s = linedisp->curr; + u8 buf[4]; + + /* Map segments according to datasheet */ + buf[0] = bitrev8(map_to_seg7(&map->map.seg7, *s++)) >> 1; + buf[1] = bitrev8(map_to_seg7(&map->map.seg7, *s++)) >> 1; + buf[2] = bitrev8(map_to_seg7(&map->map.seg7, *s++)) >> 1; + buf[3] = bitrev8(map_to_seg7(&map->map.seg7, *s++)) >> 1; + + regmap_bulk_write(priv->regmap, REG_DIGIT(0), buf, ARRAY_SIZE(buf)); +} + +static int max6959_linedisp_get_map_type(struct linedisp *linedisp) +{ + struct max6959_priv *priv = container_of(linedisp, struct max6959_priv, linedisp); + + INIT_DELAYED_WORK(&priv->work, max6959_disp_update); + return LINEDISP_MAP_SEG7; +} + +static void max6959_linedisp_update(struct linedisp *linedisp) +{ + struct max6959_priv *priv = container_of(linedisp, struct max6959_priv, linedisp); + + schedule_delayed_work(&priv->work, 0); +} + +static const struct linedisp_ops max6959_linedisp_ops = { + .get_map_type = max6959_linedisp_get_map_type, + .update = max6959_linedisp_update, +}; + +static int max6959_enable(struct max6959_priv *priv, bool enable) +{ + u8 mask = REG_CONFIGURATION_S_BIT; + u8 value = enable ? mask : 0; + + return regmap_update_bits(priv->regmap, REG_CONFIGURATION, mask, value); +} + +static void max6959_power_off(void *priv) +{ + max6959_enable(priv, false); +} + +static int max6959_power_on(struct max6959_priv *priv) +{ + struct device *dev = regmap_get_device(priv->regmap); + int ret; + + ret = max6959_enable(priv, true); + if (ret) + return ret; + + return devm_add_action_or_reset(dev, max6959_power_off, priv); +} + +static const struct regmap_config max6959_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = REG_MAX, + .cache_type = REGCACHE_MAPLE, +}; + +static int max6959_i2c_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct max6959_priv *priv; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->regmap = devm_regmap_init_i2c(client, &max6959_regmap_config); + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + + ret = max6959_power_on(priv); + if (ret) + return ret; + + ret = linedisp_register(&priv->linedisp, dev, 4, NULL, &max6959_linedisp_ops); + if (ret) + return ret; + + i2c_set_clientdata(client, priv); + + return 0; +} + +static void max6959_i2c_remove(struct i2c_client *client) +{ + struct max6959_priv *priv = i2c_get_clientdata(client); + + cancel_delayed_work_sync(&priv->work); + linedisp_unregister(&priv->linedisp); +} + +static int max6959_suspend(struct device *dev) +{ + return max6959_enable(dev_get_drvdata(dev), false); +} + +static int max6959_resume(struct device *dev) +{ + return max6959_enable(dev_get_drvdata(dev), true); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(max6959_pm_ops, max6959_suspend, max6959_resume); + +static const struct i2c_device_id max6959_i2c_id[] = { + { "max6959" }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max6959_i2c_id); + +static const struct of_device_id max6959_of_table[] = { + { .compatible = "maxim,max6959" }, + { } +}; +MODULE_DEVICE_TABLE(of, max6959_of_table); + +static struct i2c_driver max6959_i2c_driver = { + .driver = { + .name = "max6959", + .pm = pm_sleep_ptr(&max6959_pm_ops), + .of_match_table = max6959_of_table, + }, + .probe = max6959_i2c_probe, + .remove = max6959_i2c_remove, + .id_table = max6959_i2c_id, +}; +module_i2c_driver(max6959_i2c_driver); + +MODULE_DESCRIPTION("MAX6958/6959 7-segment LED controller with keyscan"); +MODULE_AUTHOR("Andy Shevchenko "); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(LINEDISP);