From patchwork Thu Feb 8 16:58:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp515106dyd; Thu, 8 Feb 2024 15:27:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW2j4InSDV/Nxi3vDqG4lRnZYOMxoYsgSBvVaHOtPS3u35GSphcC47meYfpWyMRwOM51f6C0MCyLaoBAbkcKbOmfZwGBw== X-Google-Smtp-Source: AGHT+IHIZXIp6SXxhR2FOhlwK5LP9cIdnTw6OtK5YvKNfnqAIiHBtNl8V+C4IyZD1y4OP5xAKdmT X-Received: by 2002:a17:906:5a97:b0:a38:893f:27c2 with SMTP id l23-20020a1709065a9700b00a38893f27c2mr488801ejq.63.1707434869889; Thu, 08 Feb 2024 15:27:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707434869; cv=pass; d=google.com; s=arc-20160816; b=XrkIbskoRlju+J5PDQ0GDNTrl7o9Q9TZccb2BjtB5ACJFTsp63Yk1Bp80wecod0UKO t0v0ALNavGVUrcedfYkc3zyiTsfCGF9g9zj3r/CWDh1SrHtH48vhiGaeTrAjFN+l2Q+Z kJPpOFPw8O65MElz5eU598OXIXeq1amrerNOuWjlbP6rWNw190YCym7YUCJh2ayY7jU1 dKtuGxW4APuzMyW32QpV4gwnHQDTHqgZ8Bl03fZ/2IKcEa70a2aaxf0CWV2Vr0Vwv+16 QrKaH8ebuWFntH3Dzyvh64ImX8+rYjwJHMM/NwboUlAoy1zWH7o37GQW0B0vD+vaWbtY e4fw== 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=N+XlMGxRAyo6JW0jvemqM/WNbvXc0E8KZcSqVrSFkac=; b=M0u7DqjzOHErHsdZUBr2fgK8FXOrKytaCfBTbBD8OQf1hem6Hi2c57k6TNTLCqu0c1 U25yWIN10TjzIlxyu/Z8PWqaDy/lCzrXETFqi5wztSdjXqhIfRmXBaODGbLTdLEK4Abv Ugz4U/G+Y81f4V4h1mhgaBhgnjxdwe45+zI8mjOjzOtlrZAxJGBcOpamxIaoBktG5SrP m+NK03a87pRo/waJjTgipA/QW+Kwh3iFs0TOWeFQlzPvokMAyMYvekh3s3pqntN+LvnE e/bxaD5+jYjXiLuSTPY7M1J1RWXdQIhWPJOL+YtXKgBAQek2zsro54udvMnCPF1raFLM oPhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="P/FNAa2B"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58437-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58437-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVO3Qf2ubdQLvSS3t0k8iDuqDrKco00pPVEA5E5vxCwzUFM+QZobCkMhoWI3yd04tCVNUZg8lTKM4vAVHPNRt/58z+bRw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n7-20020a170906118700b00a385a10b9c5si164268eja.351.2024.02.08.15.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:27:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58437-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="P/FNAa2B"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58437-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58437-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 C12B31F2A046 for ; Thu, 8 Feb 2024 17:19:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BF5F127B6C; Thu, 8 Feb 2024 17:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="P/FNAa2B" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 BCAC982D65; Thu, 8 Feb 2024 17:17:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412655; cv=none; b=XRC65yN9nAFroy3B7A8wMwAxgTJpr4PgahI57hi0svmJueP6oap4c0o8lpK2HJY4BsBsw0FSBGbgtsWXLJ8EiHP3eOW4r3T5sBjDTom5n5EwOTus+1iB80/wiK68yRgkdY+tYPBTvYWgkK1BmL/Qrb4injkFygMxY0wwySZVeGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412655; c=relaxed/simple; bh=x8TByPmOrQ+gMAIIaoMyZZvfiNw4po8E/dT9novu62c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I/mJaE/DKYba/l4pJ3R+inl07JqGYBUxs8MBys61j3a8audeU012dNQa/KTsxlSakI+wdN5z0iyUQfIT+CYzgPj7ZsSPASLuePh+Y/uhxmJFe0jyr9FuaNg3Hl1QDESruQmXc59jIQCxJiiOTz7bf5xF/Oa6qpf2K5HdX640SHA= 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=P/FNAa2B; arc=none smtp.client-ip=192.198.163.16 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=1707412653; x=1738948653; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x8TByPmOrQ+gMAIIaoMyZZvfiNw4po8E/dT9novu62c=; b=P/FNAa2BL1MrZVpUJUREpK1qzcvr/XRxc6hhLUy1oOTC7JoaqAd67lwb SFVWcxhZpkCKjcm8lBCdTQfGyhhkrEYDgpj16rTdyjc6rL0dClctSRk8h Ndy4RAkuk4kyPqYwv5A4031RghVu+zWl1IkdCDMqaDztgz3kDsje8qM3k +42kUXR93ZAmoSGdE5VW7+aOfcKCOpxD0dEXooOK9pg9bCV6g4ETDLvpN 4yOb4Ns+EL2uY0aP6g3F0+pjmj04L65FN7FfNoXbpTdlYR8nImZuC4E9X JYigFLWLTMpnSI0luABeIdy468g2tMpWoCQpBFdwRISXD/33RsY83d8eQ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565661" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565661" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195370" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195370" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:29 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 08F1D1043; Thu, 8 Feb 2024 18:59:40 +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 18:58:44 +0200 Message-ID: <20240208165937.2221193-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790375226470836622 X-GMAIL-MSGID: 1790375226470836622 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 16:58:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp460196dyd; Thu, 8 Feb 2024 13:22:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUvKPQ5iVyiJtn+vlupF8+9YDN92UjCbafrWYMIm3DxF7T93NcOpIiVcl93KSqfSCJyQiUoEaYdVVNUh/00UyNS5qydcA== X-Google-Smtp-Source: AGHT+IGBdlT0IoPnyElNDpljw9Lvzst6jrXL4OZCCAyZV4cPqMBaZrAan7k8q4f6nQivJUKMCWHE X-Received: by 2002:a05:6a00:80dc:b0:6e0:6bc7:15f4 with SMTP id ei28-20020a056a0080dc00b006e06bc715f4mr474921pfb.15.1707427366520; Thu, 08 Feb 2024 13:22:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427366; cv=pass; d=google.com; s=arc-20160816; b=b/oROD6q/uXgHV9ixh/ixgfg6L82XQSMajD47EWtNQuml1i9siNHhggmJb5MI3NWdP qTYg8OxxUOQKXc9GNTdvPrSKlyi6kgQZAIpcpEfdyMFdh4s0BSJWk1lfCBxLR+zu8fhe l6ij7tx3Ta4KzRED9GAC2GeIhVagJn4Mv8ii0JY74qKgq18/Gl1ZTsySvKiQubOnIR47 32Jevgx1KUPO1EXHkjI0c3QWW2Ol7vp7Hy6m73aw/o9akI/h7yUg1qb4uFhJZ8SSEFNJ 0mf1Am0gS+GLxj3x41Y0DLmxHbLtUIK4mBkLJrYifxa7iRtLxwwXWx8+2icp0tBm2PRk GtgQ== 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=/XZNodid6y+BTY1H+R2MoAhn8Ey162lqTm2g8mBQTS8=; b=tevuOPHk5kOcNDBjPEzaVWxvPE28LiyDOz23F6pX613+EB4WFKRLQGom8v6YS3ANeU m1MKZv1TDIZSfplde+EPsOiVMdBBfsy3iu1QBj2GO2krxJxKgzydC1sMdT7QOHDmzAzW IVamko7IxHTFBj00OaCmB1MG/wO7Df4y/wBj/SlO4hqtpbni2WTRfVfSPd1tgwaDNai5 UoCgRFhQok4YK/FsnQpQMz07KkMrlBU8OKqeim8HXZ5sgUjwf7nS5vVCeiSWhkn50F+v JkSXeIrB7C/fmIDLWxGprsvWpM5LZjf+k2bk74IwkVe5rvNjhTehHkty3cQu+Rkblg68 slkg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fp0c+kZE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVkAC0F0rI0MAJvScUX9ZudTLc+ZJUjEImFNlEH112TEL4u1iO8p/Ij4PInML0w0OXJiGx9zSdVDbEEiERrWTBfIUxLZw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bx24-20020a056a02051800b005dc16b88e8dsi490042pgb.353.2024.02.08.13.22.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:22:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58438-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=fp0c+kZE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58438-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58438-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 6A413B26294 for ; Thu, 8 Feb 2024 17:19:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A187812880D; Thu, 8 Feb 2024 17:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fp0c+kZE" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 10A2684FAD; Thu, 8 Feb 2024 17:17:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412656; cv=none; b=BYjJ5vZSIxIvFFc3cU9CVlNac9PsKRWmxlxtz7eRqLzkRRs9nCmRthCCjh1qt9dq7xDTVPmfaJ8EFIxj/IlPlBWNldhtoD3FllVCDW0OMbY/9Yy8YqEEefjkFdWyiJvyKl6U293g5LIxekqkcP3WxSiFSaNYjwdkfBOckAfmzgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412656; c=relaxed/simple; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gQzI0p83QScPd7J5kLD4xkhEu63XhVUXgVHo4sJUS0pvCB/CwljWyCKHSHoS2jSb+aF0e3La8s3ZfFgYPypV3Ixze56RQBhp0/ZuIVSV9kCwn4Q0oPMYjCLM84qZqqZtLZsRQL9bgpk8XEjDH0LoLTmh3HSuKHF36mR63XKr81Q= 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=fp0c+kZE; arc=none smtp.client-ip=192.198.163.16 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=1707412655; x=1738948655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; b=fp0c+kZEowmfNUNS9/4Jd/LUh9xAaXlw14STOlzb+SRcCIOOvuGQKgVN Tl1IAVql6UUkNjrnpTpSqfpuGsXAyahmB4fv3ON7FPXAmY4FfDMqpA+o1 NrQ/doaAcVS6Rga7GO31fwqC9dSBdn5gDY2hIiqEWWc2QYIFozv7kyrbx qNT6vkLPRaGVkjpCknFgD6TVi0/AYfFUAnuqY69fdHakF6bscpjWhc6iQ 3g409BqEu3b4UoZ2a5GvaXprWIVtzzl3QDDhboWZDvAd5CsK7sda90P/y VCMmpDgGpohWDOLfq3KyzwTu7oKV3T5toJTg/aeXA8zLYpQcsWQmAvfPb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565672" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565672" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195372" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195372" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:30 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1BCD013C5; Thu, 8 Feb 2024 18:59:41 +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 18:58:45 +0200 Message-ID: <20240208165937.2221193-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790367358581110760 X-GMAIL-MSGID: 1790367358581110760 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 16:58:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp514887dyd; Thu, 8 Feb 2024 15:27:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IH37vFVK0Z66h3ArgYZUUnQKIr1Q/NoLAPstNHLqAGPYjf17v/z29HkQse+COWIJwrjURcu X-Received: by 2002:aa7:c644:0:b0:55e:b942:aaab with SMTP id z4-20020aa7c644000000b0055eb942aaabmr43680edr.23.1707434836193; Thu, 08 Feb 2024 15:27:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707434836; cv=pass; d=google.com; s=arc-20160816; b=BF2gtyO5yynoYeaXT9a/ZBL6C2lwShT0lXfKEH7zj4vd3q5ZbWKtseAebd9qZBrSJV o4RIxE5xriFA6DbEulpzRfYzCEWN37VVLEDMfOd7RIn7wJWGA7KxlHOwUS3+zbvADL4z kUIWl5+/DXcez+vim/2eYSYbsKvdVZMcdYY2GE0M8ld3RKHum7M64nnuB10RpKl6JQt0 KmfpHA6eFHaUHrjuvxaXCH+vdRzH2kbCkqXwpUrTEQz/Upyv81oiJA8/zn3wFeJs1bm5 Y81dWALYlIgOufXJMvBV33O5rH6Ddkk9O2LQ/U6JLj6wxSnnm0tmD9lUWhKfzuNeYosN 2SlQ== 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=/OAQO8hUx8k0w6cphtaD6XlWiq++zx+kpELNiZ6lc4U=; b=IQwDL2Eq2RABuYQxzwnalA1fEGB95dc6TPp1x3TfUspXB4vMr4UVa1l+nc8ac7ma0e QT2zqntg97hF2E99yFyd6GX4XNKRPQKlWFe6z45aQCSeVeLAIJT+UqU1KZ3Ub/Vf4LDM BSAZNYXRonpVJH+PXN+4YbNHxte1M0Ud1rvHD2sUQ3vZscJ/1cDZ+v09Qxt67kMdi23e 4kRCnPyCtTv4i23k7ohZ9BUsFYxjUFbOp0OqdeSpIWwGX3gg8xT4FQs4Apk1pvg2SjkY QDTwd8hFjWhSZLWB+XIRWqz4jExkvc7c/IaVi3OCbmvUmSdOuxxzhd4N7V4Wd1cB/+Za BqOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RXVWHN2j; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58432-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58432-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWImc3826biiZtjlpWI1p3DKCZRgN1+1EAXRN/dNEf8UAGwSe3pA5vgSCxpA24jRIAzzTfNvAwWE8MbwIteGvXEIb/VqA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ca2-20020aa7cd62000000b005606504da57si198749edb.172.2024.02.08.15.27.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:27:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58432-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=RXVWHN2j; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58432-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58432-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 21B611F28AE2 for ; Thu, 8 Feb 2024 17:17:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24FC682D93; Thu, 8 Feb 2024 17:17:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RXVWHN2j" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 592CA7CF23; Thu, 8 Feb 2024 17:17:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412651; cv=none; b=Uck6OGV5CNh8fmFabWUedKj39jK87io/K9aFD4zh22nN0PtR97baN8YLx7vsZr3MkCNY6BAjrGZuxM5DsuGHDq8Edg96Yjvwq2TE4aw6JYBTrYBbsUt0QwDgObL67+zsfY+YcGSB72dCOXsjm67t8awZ37yRN+mXv5It2+hDRCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412651; c=relaxed/simple; bh=LvC0jNLSvlISq+pfX0tunOut+CloWPeckMMVxbBHVes=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jSN56725zDkvyIh7k8y1NGW3pJgTc4u63tG69v4WxZabRtJTM0rUY7KtktuZa6LFxslzqHBLjJC6D81mZPjaeYITJm7oZorr36MPmb3uLl+TPasvL6hnUbmfusLKYX2tXIrdRNiVxLHh4ooPopIPTGYDEqjhLw43dGUP1yuhqhs= 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=RXVWHN2j; arc=none smtp.client-ip=192.198.163.16 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=1707412649; x=1738948649; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LvC0jNLSvlISq+pfX0tunOut+CloWPeckMMVxbBHVes=; b=RXVWHN2j7xYe3EkiNvYU5TviV2CFsuljkp7R1di2FqeoAZPfvFKrXReQ RG5bns25xeEZlneTRRE7HI1UflSRAhxdT3Gr9xqFwtoilTHNIsp8lebrb KSnYMPiNKEpk18tEApze86BvwOD+WUQe4nMDpw/crthPefh9eB3SWJp95 W9vUR36NkO0368B9LkgyFI+48NSFVlsYow+usFIhfuZOYvhbVQst5/Qgf NFO9A3QtKl8TGOvIQxURYXULgXYU+gRlWqGgTLyQojzAjFjXev25v5jlh RIlK6f3I5qxKVrAdp32LU5F2sszzgFaZcnPt1Gf6DEMIGRJqiQRDES+td g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565633" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565633" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195354" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195354" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 210101374; Thu, 8 Feb 2024 18:59:41 +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 18:58:46 +0200 Message-ID: <20240208165937.2221193-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790375190822141519 X-GMAIL-MSGID: 1790375190822141519 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 16:58:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp499016dyd; Thu, 8 Feb 2024 14:51:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVCJGW7M08wu6kn62xYwhDvtPqOEGD2A37OCRYlO0E13FaS7tDSBQm1RkcBCCeWCw4j8oIZi0X1XRbbspx+OpqqZ4J1Sg== X-Google-Smtp-Source: AGHT+IERa0jPQbXeHhq+s7X8jqqXduQtLBcgnBbNLknhR2FQ1eggIaLj7LY/poEVntBKvwirIH51 X-Received: by 2002:a17:907:1050:b0:a37:7057:5b3c with SMTP id oy16-20020a170907105000b00a3770575b3cmr398699ejb.50.1707432697307; Thu, 08 Feb 2024 14:51:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707432697; cv=pass; d=google.com; s=arc-20160816; b=WXQiEKz/If4JKVR7sxHN7m2wImycMz1ajRtYTE416G0g50pgOz1BP29oK69CRFNS1F yicDvreHAxnfgC06AflW3u/mgexGvHZ8Z2ta9Qlsie+G/EXMZhtLw+DUP/g/8e+c83Mr OcSP/e1+SxdwaajgyVfQsqqBdX34VPR1uNhRrU4yVZTCBzv3t+RdKU1CHgB9vRHpKi35 3nnmlMQ3Ae7ZLPe78pyg9PRGyed9X3xEkB5Yw+wISMxW0KtkKzTFaTFugJlTX83lwBN5 F/Vnj949ftzls+ECfuIT3fX8TC8MyZJCvCXEhxjOLq2CpN+Z/+7HyCl5+lUH/CIbkvmY ewSA== 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=pHjJH7/WyotkhuhdtWmxTBMf3OyNQwdxpgrAQSzamS0=; b=iA9Cq1/BkjrEYgp8wxLkXNLPVB7qbmeq0a92YqUuA1Jfk3R0rBKZfl/Pq/83kSAoZz wOQT+waeuhKQmczmIxV02/4jL27acubPZMz52SfMhK+KzUbY9ZKfaM+k3eFs4j2FpIkO p5F0+cAhbM7JxkCyG58hkd1y8XTGAvu/13GIn3ZArgVEerDhuDbigAry/lQnbFrA0kqN HAIbNU6NxORzR0xxCQjGbQJH8ccIA0ItgtC/dWOVGBunILqODrXzYjhG5R0G2BqdozJL 9eDCMRvgsVXb1ZsJupmaEB2+ZVq+szsX7vrdW6/3+CUq7ItSJV2xWFu8hlWshPICUeYW lauQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="UR/MFjBi"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58554-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58554-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWEfAYDxSLLluAGyyLfHngZgbyGZESwrMmpCRhb1oIYqe1iO7HF+Qf/SO9xLCnsmevPqC+yMhXtO2aJLooQ/yA40SK9oQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d9-20020a17090648c900b00a3ba3ffe968si130814ejt.915.2024.02.08.14.51.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:51:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58554-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="UR/MFjBi"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58554-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58554-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 76C5D1F2D385 for ; Thu, 8 Feb 2024 18:47:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C34492E633; Thu, 8 Feb 2024 18:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UR/MFjBi" 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 91E012562A; Thu, 8 Feb 2024 18:45:56 +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=1707417958; cv=none; b=A5S33koOkNEhDdhV33tGykQnwNVvn5WE0bX/5DcttMtrUZffbeLwxTpfpccUw89DQYIM5aeaIcL/30Nv/dk9RVXAVZgYqk/U5pxtOess7h61W/HxDNu3jPXWCzSYRIqaBdAL5Nil/quyRHDWBXLwWF0w+n80CFX9rSpJxzyn79U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707417958; c=relaxed/simple; bh=xSKeAKNBA96roisQYOcxV4QilUZU+Ks7Czd6oPoWOHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mhVTXmIHPj3Tvo4hXEnhtAAJPeHoHAxCAkANgmq9xXp9gv92nwVJscXrbjDkGKPmyJ9Wau1AIrYPbAy1SK+85VEoQIDHBImrHNBo25/3PUtQkXBBGeOi1L2vNixf2kTv+aUW2e1DBtBzs8RXjTt4A7LWvCQaj38Jc7mZ/4wa1kk= 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=UR/MFjBi; 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=1707417957; x=1738953957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xSKeAKNBA96roisQYOcxV4QilUZU+Ks7Czd6oPoWOHU=; b=UR/MFjBiVReft1FQ0unS0YgCo3WyzG1AsdBR2ipGEozVVzBEaP7AMokA aF4MOXbDk5nSN5gTq5ZbXNELDROb9f9sEkPYj0ius5gyBhP+Jd6IETXgY d4oVA4lRZ/cDpDkOOb3L93vyTvxDK7na0rSyNiC/ezP9u4Zcim9qgJt7f 6HtJwouQYMfNKGjI4benqvhr0m3SZDJ0rL1Hq4QLl6gtvwommtS3FRWO8 CPie1DYG7GD3DYmIA6zq4MYLCHNTZU18Xh2ZLo/giAwKDNxnAI8uF3N4Z 5sVDdXuRtkH/XtwVJKoe8PaXFKMVJvIGaXHpQZw6j92ePBihfYTN5b71M w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1185260" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1185260" 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:45:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934214478" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934214478" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:45:51 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 397BF142C; Thu, 8 Feb 2024 18:59:41 +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 18:58:47 +0200 Message-ID: <20240208165937.2221193-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790372947757886720 X-GMAIL-MSGID: 1790372947757886720 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 16:58:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp468786dyd; Thu, 8 Feb 2024 13:41:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV83TJdQnZgT6vXTb7+ff1iugCYRv1PHT6/r97R4FNNjwTm5wGJn/OxlLIiEwKdRDFGwf/NNqY63usEt4dJ7PumS4nkOA== X-Google-Smtp-Source: AGHT+IHdke6aga1/RLmwKZsCkQF6uENXf7mvhnhwgNzrKdd0pEJK/2bIiKBQx/yOE1QReWNY5fJ2 X-Received: by 2002:a05:6a20:8618:b0:19e:4fdb:8e77 with SMTP id l24-20020a056a20861800b0019e4fdb8e77mr664542pze.51.1707428473370; Thu, 08 Feb 2024 13:41:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707428473; cv=pass; d=google.com; s=arc-20160816; b=fW9UNT08gck+7rPs/X0n3+1niyjkP1U0ErHytmx48QCkPXpmBfodShCZqOAmnmXxpf 6JDNf9dzl6kgoDIvzdZvWKpC5uhRDtj9lYveu6b4mDfsksDh0qbzFYJqSIS1TqPaHBPb UZrML7bWbaDBIZiNlwy70J5hNtdLO04YXaj2/uT8fd1ilURccVFkE/awYMFqcjFoLB1T EpnobZ2cL6L9MuKX9WxD5wMI7OLqyKd2VoT2zpJWASXgWtFzMEu0TEFGxLQk+9xnILMw GEm0GUUvm2lLXefoj1wjKr7YgCVsaGaBvb74k6mpdIo/ka7DlJvHaq0WJ3YrtQZvSp1S th5A== 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=uvz989JBDhRpfW+PipIx1Kuw9LwtCXSHRsAcl/FSAr4=; b=WUkIckkzp3SSFpleMiPO3jqydXAi4UVNBmOkOdsgaF5uJYBnHh+O5lf1eO1DFBSzl8 i0G+K7WNRuE9mr/6qns9hzVcOPI0lhDSk3J8yZr0fuol+216yWNiXuOZ7zFc9/Vpj0ZX cALPR6m3TI1i15oHkJNT4bRoWZYlh+vvTPyq8+pxoeaUSO/OkQYYLLfqaYIIKwTNwAit 2yqP2y++3nkpd8JtEr7d1ZMmnGFvMpk9itAQsCknTbsm8uU33o03PBEevQGstLt1+aFx 4ptTVM0lA5TNGFwuOawvudTSy9Ma6+uxZaXDMygyH8CPuVs2oGf0t9+yqKaEpuTboyfg MCOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="TnxemnN/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58553-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58553-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVejB4F8pIGMVIK+32V8JWb4Gy/fCqjbcOIYsczsaIBmwYnYWNURZcCD1MITZySzWBYwAwugRwkEQ8nJJzRWc8y5PKEVw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e23-20020a633717000000b005cdfe668943si467992pga.781.2024.02.08.13.41.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:41:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58553-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="TnxemnN/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58553-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58553-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 88168293FAE for ; Thu, 8 Feb 2024 18:47:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 311E62E414; Thu, 8 Feb 2024 18:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TnxemnN/" 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 066ED2560F; Thu, 8 Feb 2024 18:45:55 +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=1707417957; cv=none; b=SZASSLVHAUy0uo2eyUUHAtUNL7DG/kSiF1f0Lap3cPnbJiAWXyf16P03ymTHgHNlg43b5JEXVQJybqAkj5FlZssL8Uvp1ry2CP1UUhNAoUUkW54T0PyfNep+Ok/6L4AQmOHr0S3pqV0SF4Sa+t/fZNXOErroquGzJIf5CE6oEyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707417957; c=relaxed/simple; bh=FC1cjzT0133HljBbHlbObVyjHCu4QTG/1Zt/QXNpVSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AdLxS789QnRe1OOpI1OpIPuiRxaFZrZJgCF1SylHADx4PwPfzmITI9CZho85BPAwETWgb5NvaRUl4dlhCRSjrKZ6bT6LD5u+OYSRQCbzjkLXjlJznokpnK3uM0Yn96G43a3ACiq3Ni54vsPczzy35jNBts47qGX/nvrm43VkHTU= 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=TnxemnN/; 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=1707417956; x=1738953956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FC1cjzT0133HljBbHlbObVyjHCu4QTG/1Zt/QXNpVSA=; b=TnxemnN/eBQMO2L51rE8zBKS2Y6K8M5lIhtDmq/uoJFVmIdkD8wjdC2W y2zBWJpFT+LnFGir060Yu7bTK0hzVyb2+pAITTJwwocxpmHplbolZ+Xyd 82NWqK/x64/5iT98LcVVDzasC9V78BmH5LnhS6+1pqkCmjNOKkOpFJiYk MxA6q8LkzJp/Yiqty4xKOp4ArnzUTkmYPyj1MtVuQ7ONN6dAL6DE4iuHW 3yWe3rll+2KmMdijYXaiM5pM7/wW4MXoEx0kov7MBkNgBTR+bU2w33+2v f2K+4XUDDwFDbvbimkLhIGaEVeJSYXmTksOn7NRvNXlA6Gyu40yqcNVp+ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1185255" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1185255" 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:45:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934214477" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934214477" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:45:51 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3F5FF13FD; Thu, 8 Feb 2024 18:59:41 +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 18:58:48 +0200 Message-ID: <20240208165937.2221193-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790368518977479375 X-GMAIL-MSGID: 1790368518977479375 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 16:58:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp416795dyd; Thu, 8 Feb 2024 11:57:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQsj4H1R8v75DlDnYYl8RxyVVU60ZfIb3bIXnfY20h7e3cHNe8bV0IOHbN2fr5KC5lSp8GACI195iFx9XvcZurbw9Tew== X-Google-Smtp-Source: AGHT+IHCmpXLxrvikZLs5cpcb6x1bYWUqPjKE4X+FSeOUbvmLzP+dUDxhR6cnv6SE6iYe2C+xIN9 X-Received: by 2002:a05:6358:93a8:b0:176:cf6d:20a6 with SMTP id h40-20020a05635893a800b00176cf6d20a6mr169101rwb.19.1707422243992; Thu, 08 Feb 2024 11:57:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707422243; cv=pass; d=google.com; s=arc-20160816; b=jURSd8Axm7n6v3mpPoZ3kQS/PZi8ZCH74ZGJ4KsqW1nnidoURY5xVoED8H1CFxbVCX 5uRWHUnTzov9wCZxaQPQFcboSLqFFKiDmzOh+CKk/QRAB0lEp6yjy1aBHESsO4c7UyW0 ytHo9IS8yM4orwIjv9nkuuFl6q0KeCqQVVR1hwcA21K0NtQ/uQPL+BZZRCFsIid2gL7K iVyIalSMaEcIcAije0PRnOIKtBQfkwt3KvIfjjkf56J82SoSfSoq8t//wbVj65f5uY+z PebI3WR9ZS6Z8k0YEF5AujqVGvBS5zXftlWS7FHfFJko9YeIcAUZaAH9ub1tAsHAAXtr PwvA== 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=dsL2PYFGtXCb/cShPpQ/H3LdMhDeOCjbRBf6T3rigjo=; b=vnuPxW32hNurSqXHSqOR82FcX5HZQOBnU2/cOKzCveKQbj18Fh5W029OBFgTMlAwJi uk3+zll0DKyPd9bYlBAshFcjdmsmc0fOrQVFGRfqvV5/Wx8C/ImZOsul61+r3nwKyMYj MkwXOjGOmP8PXIcV/kmzHI6r+35ayk8eBjBGX+f8lWd6CS/b7YIcGzhkvJbb49mgGFSd o3m6e/vmkQNEu5LNcjpPalEHBNwGlVc7hAPdtWLTyIzm8XBkYIovpjj8QyrM+Ovia9tW klyu1gxFOyYLXW02/a1s9b02NKUtX0nsrcNf+j8S067Y2FM58rQutTjVINijWGe1RqlZ aIUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Jiu7mqAZ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58442-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58442-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCV2lVKSPaxs9c+wmlqVK+DFYL/WTg06NRXCbZiKc7FZwXvFf3Dg2voYZ6l+8tTsxwdtTGUw/0l3Qekh+yguy0AqGNj3Og== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a28-20020a637f1c000000b005d988899a3asi339824pgd.176.2024.02.08.11.57.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:57:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58442-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=Jiu7mqAZ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58442-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58442-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 4392B28E7E2 for ; Thu, 8 Feb 2024 17:20:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A7F8129A7B; Thu, 8 Feb 2024 17:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jiu7mqAZ" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 7034781AAA; Thu, 8 Feb 2024 17:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412659; cv=none; b=JUEgTD8oZZ4WtURLr0lcldAJDzZ/e6alT8M2MmnN8FjZt5p8zkD78itUOjglCzSxS+DivC+yY2/UI7pmHQQCORaqOoIEwsMem78i3AYF2tttta2xjUN21SxOTdFDYtF4ZZefrby5mgw6pdjcFs9OeDiUENPhScBZEpSkF4nMKzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412659; c=relaxed/simple; bh=CF1pX065yGAbwnIQLmXi74KKJnRft9elRt9o2Olm5iY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sBadysBbwNUz8DELFtDL/En/fr/wAvR/FWwqAbmdb6WVicSCAPtJFAA0Pqgyuc/AQW3xp54jpakGzSMNfxdOQPGsCbcxZKOzNHEwCnMiO7Yrk1GmmGP7gSym288KpQa/lr2mNY+QoKksxBcabh8cYygA4PAWL2dB/a6ixJBSirg= 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=Jiu7mqAZ; arc=none smtp.client-ip=192.198.163.16 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=1707412657; x=1738948657; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CF1pX065yGAbwnIQLmXi74KKJnRft9elRt9o2Olm5iY=; b=Jiu7mqAZLe5Mlq1X1gYTOo8SDIih0dE85t29c5zpp9XQB94OKyImN29m b48X9cEOyTWlcqRPh5WcDLF095o4SauRY8+I+Rcq2+YI75fQ6ZMeMtkA8 Taze+ZAcP2U7NAsoD4z23zhoyEKPnYySxB0PD+JBhWntly/Z3Xj1VravH eX1JfaM99OlmLM666vRff+NJQylCh/GRua7z2aFK0A48BpZPF112m9pua CPImNcof7pA2FDqOhC1VbU3QinNdobJlBFKlpITVxqhOv5J9yPZBBPvdt m4VRf1L/dqe3PCKuLncQB+21OyTQExeSDZXSmiDAemi4uD3lGTuhSJ433 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565699" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565699" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195385" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195385" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:32 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 496DA144A; Thu, 8 Feb 2024 18:59:41 +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 18:58:49 +0200 Message-ID: <20240208165937.2221193-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790361986909238881 X-GMAIL-MSGID: 1790361986909238881 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 16:58:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp446526dyd; Thu, 8 Feb 2024 12:57:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+5x1rMqK6DJlR9V8Qf1pn5oR+77Wa1ru0TR7g7awZ5VqyUAGa7ULdE0aG09FEkF6bUSfcqReeXym6hdjBxagiBg9amA== X-Google-Smtp-Source: AGHT+IFXyDtz4Atv6G5mFez/AVfofO7qtGznbR3AD0PRXG0YuUnEw5YLq2BixbwoAm06E6ZL9NZG X-Received: by 2002:a17:906:2b4e:b0:a37:73be:7f56 with SMTP id b14-20020a1709062b4e00b00a3773be7f56mr403922ejg.22.1707425822064; Thu, 08 Feb 2024 12:57:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707425822; cv=pass; d=google.com; s=arc-20160816; b=FZOieOU8WSNOrCM1T1Iv/7I7+7iv5tT/pMgOEZHmzbn0x8sLu0W3LJO4grbvi+iZ3Y pt5EcvTq34sFxK4lG6ZbCewRrM8uLFIx3asFMYy2BFwnu6tQXFKC2ltkr21XdoSxpyw9 48BiPVty9fVYyQUfRqiZpgmnHmqC3oo3q/X7ckjHO7nZoJ/pQrRnaPmKcvwZS0eZP9xJ wChQuK41gwoI4QHaqsr8APR77psT/z8FFbJDmGWAV+t3lO90n7difmlbP3xkfvkcdik3 qwSEwzfnqB4ZPPGoPu8QqdfIKU5nChWlSQbVMvN7cd/qVEPqqklthDHuzOkdyczcIt1A WIDw== 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=bPBXx9IoVnxH9kFfUSd/0+SnxhczZsjJIwtNULXlq0o=; b=PTXnAS1NOsOC+qeQ6PPNLYZV3gwVCe0HsUgA94IkiBUcTCYAl7opKfp8ZZsNRoY2Zk OCMXEwBFqZiFTkIuekTzOjqRCIbTFGxUg9OEj+AbPJYRjdlU52pHVuDOPLDLTSx4xbjv L1v2r644cLMzyRbG9FPgLqnRRBvjC2R0Ab4fXJxfkC7rPHXZagC1tJO1TlTPtnrmSmfO LjYHIrlm5oHCJHY1fnVdr+NLFTw0+mk4/0RAOEJA9roxjUnnIeEtbyyizeEZlCLEZW+l dT+NMCza4rifek62s1hqSvAZuCz8UzS+4osKbBqc2rzPp2E2lW1ZKjyeMzoVeljB9qHU h6Rg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=inMS7K2y; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58439-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXmH8X5RdEmYWTNBDQqYHBQ8fk95GYpjOyvY5vdEgwZMWXXHdv2fdxxhfZHUObwb9gWjojRV8sYcskqaR6oTo9pNvYhjA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l12-20020a170906414c00b00a37debdad2bsi47146ejk.683.2024.02.08.12.57.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:57:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=inMS7K2y; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58439-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 2F4AE1F2A4EE for ; Thu, 8 Feb 2024 17:20:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 762FE1292D9; Thu, 8 Feb 2024 17:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="inMS7K2y" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 022438121B; Thu, 8 Feb 2024 17:17:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412657; cv=none; b=Rv9KnAlqkyHuRSAhr9ewA0D6x4NSOUXhU86+KB9bW825HsqMqiJgk7IcSUP+Ys9kbvRFXCu+29bekThv2YH7/RbFIMrms/SkkEfGRBFda/2MnS28sbNBfbDtkEYFMXdzlLnGwOWJ223yWrNwapCkJoc16OlQqKT9IHbQJ+n3U0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412657; c=relaxed/simple; bh=Fg8HFd6qXwgrRuKizTmdQy4zN2vPEsdI81OkVtdnatg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qZ5TFir34wpbmLgSaM2ymKOzrUcJJBMJtpjVpabUzMqQNKqNwAX4+H9QA1sMPksjDJEhgjUELJB9u6CYwxoKVOAejP5PD2qKwBjbTpvyuFANe+3/joESmRwMTdDhLFxpmT8Wiluc8KzR9C/y2VBkNAUqqPyJ5eHdWZR8VcQqYmg= 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=inMS7K2y; arc=none smtp.client-ip=192.198.163.16 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=1707412655; x=1738948655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fg8HFd6qXwgrRuKizTmdQy4zN2vPEsdI81OkVtdnatg=; b=inMS7K2y4NKgs4TmUojWeFTQYcLpmiR0bk/Ch8CkMFrp8ThyJLBhG8NE drYRM3C2w/TpbG/USSMEVBJ2f3zNQH1PRIIHqB2qwdl/nd2GDvChKrOyv ygNJw22cFBClhc7WSuvo5xh8R6u5Zfjl+kF+r7cZKyVihTH1L8nusioYf 7lXA6jv12BHgu56hpw866Qz9lpxZcasDW81QeGm+YLuLIjHQ8jTbfR/s1 z77qdPPkdELhPYUxxHuaomDsoF5VOwHbC4RCaG+8zvBhxCbUPG1FIIYOP +ahV7KS06Ul2kEsN6s1KNzJRamJ6/OFWe36dpyegOdBpHyvYR/iuK+teM A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565667" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565667" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195371" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195371" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:29 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5B2E6147B; Thu, 8 Feb 2024 18:59:41 +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 18:58:50 +0200 Message-ID: <20240208165937.2221193-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790365738601541808 X-GMAIL-MSGID: 1790365738601541808 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 16:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp444312dyd; Thu, 8 Feb 2024 12:51:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBE4FNROnzC+4gHPuGfxk9o1Jhnccv2rPY7UybhmIDXhwRMylANpTP8VHArxTXV4fStNb5 X-Received: by 2002:a05:6870:1701:b0:219:acf2:cbb0 with SMTP id h1-20020a056870170100b00219acf2cbb0mr781096oae.40.1707425494889; Thu, 08 Feb 2024 12:51:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707425494; cv=pass; d=google.com; s=arc-20160816; b=E5WK3EtYVj9YsBR93E8MzQnoqq5BgJhnBjviL+yJxrE0CCFzYzZWp2ffAmnCYnCVvL dTYz8yN0LLy3Bj1T7JvTW2nBPPPb2dLri/NO9zpLEoRR97kvBKg2j/U3gBQkDkoK9AzU R4zlRdIrVa6O/4yMP04bMVSUob/TYuXCBmiodanXy2bchIn5v+ttX6AcxzxEiotdUa7D dxdKJzIvMydCxr9HRscvTEUmxdWqxtZyPVc7rqJTdaScEEieFJG7X7ZovztWoo0zBdXa 4oxlOolH8j9galilMXqSV2bVoj/ix00ekjUvlpzn8KSkz8PTKfizhh0yww5qi32f9fKT cAFA== 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=aeOnbW0K0d79LufhmueexsS7T89G2FlqVjXvl84ClL4=; b=eIZoB9soKPnMQyAoZjeGxt/F+6WQKjWIRjAgg+LK8CcrvBAPTawh4BbM4XKVc8F1fW evUxv1nvD+/xl6IrRQIZy5lmnHSiESqDT2auCigXax/mZ9EoYuVGgwxzkVZk2PJmZ9Y+ hRMl2tacfHfFxc3VMWdvI+7W0UUFOUHSkyzqSk/824A8s1awJyyTX/JpdGOXYtYdZiXI fNdkfWiDpx3G6zTugIHTH0I04sbPCMZI5QzPgZiiJYVogi3wVlaTZ+biR5zovHOObyPU fULP0SZAJWoBgY4xzo++vEKmutntzoRM/rzzPMuIpvIXCzVys0pbMysYg+4E2zzRi+R7 BjmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TqqSKuKV; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58440-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCU9MLZdfqnQ5rQqlXlcYy+4+ymJ6xc6Dd3I9NncK+nmSjlLRj6C2Z2o/eqUky9i3ZTH/EdliNBZjhMgnejoWkeDedWj8A== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o19-20020a637313000000b005cdf37c9c29si381597pgc.703.2024.02.08.12.51.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:51:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58440-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=TqqSKuKV; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58440-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 BF315B28C10 for ; Thu, 8 Feb 2024 17:20:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2560E1292F6; Thu, 8 Feb 2024 17:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TqqSKuKV" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 A517B85C5E; Thu, 8 Feb 2024 17:17:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412657; cv=none; b=MRCyB4l/UcLTTWN5JWyHc0xIl19r+VwW8fA6niSGCCpYGAyK4vtgeIJ56IS9F6mM/TEZIistOpRzrav8/52Ubm2ePqOZcbSIcQnrroZR6nx3W2cpF/I4HQ+Ofy81IcO1GLlS+0u9RJl8OufpTrfzpmaJK9jDIwG5nzhrguIxaAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412657; c=relaxed/simple; bh=fRF6aaXYm3WO7lZKrdtFCzyzTyXPONtxX7sbViupAFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D7VyuEYR596vEPAftVlTX4hsEoRldgRBhJA0e0Oo1s+GPPSNnszVmHt7+Ym1PaIKu3KaraSmAzFLnzdfhOmyZU6mI50GHtcNlAmMBazHA+jrngWzmJbU5covoUeSfGkOVe+fck/w7iEG8TW1eEjDvMomIcGX30De5vkVPOujcw8= 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=TqqSKuKV; arc=none smtp.client-ip=192.198.163.16 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=1707412655; x=1738948655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fRF6aaXYm3WO7lZKrdtFCzyzTyXPONtxX7sbViupAFA=; b=TqqSKuKVMhemuwLOQqZ5H0RtPLHhJOZ4Yk2eX/EM2+e/CnQwTEAodJo4 iZGn8soXUTKqK5hwWy1/372F9t9uHhDvSm9Ni756KTH/k96xJoSamGNxe m+UefdwB3KGTuLM7msmSDUqP2efiFFxzuYeooijZ+XT8d5axiQUWQCu/z hNgv+MtsJyi72lcjtFqErABLK+lMUEFdl7aVCdvO6tmcOv2mS91qsRn1b YcmDBf0hfT5XISFxZ/bfa8DgkWtTspGwbQzrX2uoxsLRgv1v4MYPdb922 VTtsqdoMRHe/pI+s5qeRebkX6Gqm2HMH4tT+U3RSgC984HMYboktplaM0 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565685" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565685" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195382" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195382" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:32 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 608DE1458; Thu, 8 Feb 2024 18:59:41 +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 18:58:51 +0200 Message-ID: <20240208165937.2221193-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790365395664566473 X-GMAIL-MSGID: 1790365395664566473 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 16:58:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp372823dyd; Thu, 8 Feb 2024 10:37:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IERomNj7QzzKi9QAUgCJKz3besoA2e8RAw0lSuIXCdWp4+yzbRS4bGClkXgtFaKtJfKkiYZ X-Received: by 2002:aa7:da4c:0:b0:55f:f73d:c63b with SMTP id w12-20020aa7da4c000000b0055ff73dc63bmr70639eds.20.1707417431442; Thu, 08 Feb 2024 10:37:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707417431; cv=pass; d=google.com; s=arc-20160816; b=F8DrytearqzDL/BtBQXtzQvXVA5fohFu/EPb2phr3+e8f7o3vx0RyNVHsA/AExLVc6 VfOlF9uIx4/ivEwEd+oF6p8ky16FMI6YmYiWEOXFT3DtAlRAiRKwo7JaA30edFvFcBKD CewODfOYVQg0XSsbn+TqDJbexFKHzGoKi/lQyOffHUrW96YSkMcREhfd2qW51+Vp0tpP a+CxEp4pjCxqSO0mKcFWVD6xmLDt0VwuXqBiWU61a5B1ePPdaRUS/Ik35RehITTUSkLr +AQbqQQ5vU5ivxkusEMvDpBtWGltoPmhsLBQt1cp8RbzZX3533AXd0HvXnVn5F34eXqd ga2w== 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=xC53Pxqkjj6vZ4JnH34JjzRG2xl82TNhwvoazYdR+x8=; b=J8nQ+0e0T9/xtAqWa3vJ8A+3AE08jU5bahCSFvHTaDz/aIpaI/2E+I6XqaVfisHnUz dyl9dci44nMgQakTrM19C8elqC0VWjdA52xshhdCVSX/mpoQ/8ZZl3VoV6z5Plag/IAa xZRjcV/keM/KnZLSeQ3a3F/gtW2LhCB1fVsFChaNeQoS/Ov8Y8ir6bJ5XQu6aHODUujk U5EjYA1uqGeNfKoW70R69vGqsLbMaqGVfJH6NkpBkgZ2HnvmvAYHVxzoBp7XhIcXRyLC ghF3nuVHFPF8SHQ/0qIRa9zoImMcpVGhu3Nyc475ACUcmaCQIIs0U4mLIdacC+jHv2af Q57g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jqWqYyXw; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58441-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58441-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXiSiied30WFhFoo5vE4K3MWMNzIPOPuSuLcc7PZ8qcFX8yl4RHa2m+1rD0KcJ1Oqct9OtGnxpKD/8qmAvj5qS0GGZcgw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b10-20020aa7c6ca000000b0056006ea87b5si1118277eds.422.2024.02.08.10.37.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:37:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58441-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=jqWqYyXw; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58441-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58441-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 201F11F2A6C0 for ; Thu, 8 Feb 2024 17:20:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E38F129A81; Thu, 8 Feb 2024 17:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jqWqYyXw" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 B97EC86ADD; Thu, 8 Feb 2024 17:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412658; cv=none; b=uKP19JLb8rHmrFamca7c7a9AYFwa76vm6KporXclgOwscpCrAXstcOkDlZup5EGDkpHTnzv5Z0vvug4WXsADSDDr436Znv89nWDbwwmMxx2XCWRqCDHGuIoA0i/6SSe/czxb0uTbUuDAo7TfN+Qh0J5KcMUEjNC/skypgqm2v3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412658; c=relaxed/simple; bh=D9KNXApzrQn/zL4buEhPq3QKCgL53LOywh6Etg3+aBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bFjHG7AXVWPFdeY0F2LrNkpLTT4cMpkYwz0bMCvrDfihil4H4ArjpY0KeUYq0tP4ulK3dxTXkSjw3zMPgpA5eCYIxjwY2C3hKSxo4bEkr4KRj6ocoBKDyynCwjtlNG/grjSk4sa0SBY2aIIqGHK/iSgF96q9h1NbN0rcSt4tKBA= 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=jqWqYyXw; arc=none smtp.client-ip=192.198.163.16 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=1707412656; x=1738948656; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D9KNXApzrQn/zL4buEhPq3QKCgL53LOywh6Etg3+aBQ=; b=jqWqYyXwWSP71CQMfpDYLvg+aC3x2Q36JEMsA/WUkXexpXNwh9YPrBA4 vv1IWfPY3vNlLtEHG6I4bpDbMwjn9VxcM4abHcvzc4+0S6JFncNKnBDqq Y+uSdSs3dPVew9z+7AHmffkEt83Jw+aKS1RcpzADeyJKWoxCg+t/znp6W +OHgSpGPrtKgviktA/vTMJGo56VXX8bbffCOjjqeaBKoWVFRfRuO+Bv+Q 1OWhY9oz7LqkebMJ1ON06FHNujNuMCbhwj9dxiZtLIH24rbRO7c8ePHw1 z3aTO9zt3ae9cEDmCcHYyIkWKBbKC+g5Gu2v4HudBbwj7GKlkknXAXGAR w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565691" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565691" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195384" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195384" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:32 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6ED341529; Thu, 8 Feb 2024 18:59:41 +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 18:58:52 +0200 Message-ID: <20240208165937.2221193-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790356940402275637 X-GMAIL-MSGID: 1790356940402275637 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 16:58:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp449566dyd; Thu, 8 Feb 2024 13:02:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUcA5Ly0hIgsANv8sktDvJgV0RGg3EsAy6NyJ5kronYIHMaYDI7/SHgqh/qGQpfvalwuh1Br7HEu6JvEiR+/3EzjBK3Q== X-Google-Smtp-Source: AGHT+IH93+B1drPhFD2bunVT031NezxJzI8ha7nDZVKIxxxRvXPs1WFYdtcnsThyhxuPzu+rXbRR X-Received: by 2002:a62:aa15:0:b0:6e0:4ed0:7b38 with SMTP id e21-20020a62aa15000000b006e04ed07b38mr429524pff.4.1707426147647; Thu, 08 Feb 2024 13:02:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707426147; cv=pass; d=google.com; s=arc-20160816; b=ZxG1Z+Ecc8xILbNTmpY7gUd/t8tYOaFBdJRDKfovr+uFnNTyHcie30I1mqUVkuAP/G YjGLRBx8m2vTy7SPxSkC0l+gIyNYsSaD20zWZudBeFanlmA1Kz7CyUIlp/KIoKEyi1+g YeJaunoRz4rMY0g54WO6FJ6Ua4V82tax2td1RlDXp/MEl404Qa0kiNPSFzyEhjtF1Zbm LM2ywRnpttegD7ikwnxIfWHHNS9Uo/IzOH0GMYt+TODnofFDHfXDJbrNjlJppalIsrkt noiV1BmLO7ZvxqCZO4ljax6QBsxoX1eqeViSB+mf/Apqbhy+fc9TS03SrTWaI6+MFld9 xy1g== 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=XugdtMg7jMXgILsLsrVfgCI0xRqrOAEEmawoUhYo8AU=; b=Yd3FRvOLLTq/zHH43Lacbmseln2jS3MhJcjmAlNdghDyGr8FOhspHnFcz/Uv2t9MEj lND/K2+HArzcZsY+XvBJ6MmigLVWTe2uGUpDwn2spbRKpuhgR21vJJc8Dy1l+tWXZYhT ox9UA2LDaJFtuPjAbk/Q65Oc0lAV4UMoYdXQqHXL5EC1xCe1dOujbvc3gxjeemtk8Ih9 nM0wbZl3NpRfTO7GIr9l4RYFynJ2Xusll9I+eVkMKQnzqyzRiEyYry833+A/H+UasZYs Cla2aF+1XOOWJtSytS4vUwFQGXR8NLpTkco9JhNwzmP4WV974PCsGPALRIdEsBKmgaQ4 GfVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=T1oRVPtq; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58435-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWJqLDBuHKAGDv6egoySnbLojPZWNeHE9YnSYfpo44FtSrWDZfaPLsBeBI10wBItfZSkq/1CnnHlDzh38UMBaGyBtCYTg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n28-20020a638f1c000000b005ce69895fd6si414317pgd.686.2024.02.08.13.02.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:02:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58435-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=T1oRVPtq; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58435-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 B0440B285AA for ; Thu, 8 Feb 2024 17:19:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1A681272CE; Thu, 8 Feb 2024 17:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="T1oRVPtq" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 12954823B8; Thu, 8 Feb 2024 17:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412654; cv=none; b=UbND9KlPvWqeFLDbN6qs7FfXiTY/lG1gLKcCF8n7f9OPKhzszMUjHJbViBK0kzaqItMjHaUuZPx45gHfoUwPd9F8nIoGQ4FpypgcRjUSv8PiHuuiJkfPpDEv9/YssuQ/O8bo3gZdPvSzthF4c5hnUsfYxX4ydwuFnZYh+j91Pzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412654; c=relaxed/simple; bh=T8KmXvh0YgA9eNWvtIJ49Y3WYjlHB5MaL3TkD79lAqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZN7TqNnLOXUJ/ITgc3mNzcpePZjLGMBTq0zwmOVmn27rbhjq7UlPzx+XSa6zSpX/lwAsKJZy0/PxPd6pOUHRUHSDsyocD/Mg03vUo8//jxz9WpIlIVez/OC5kDGgAr01hjJb2UnPrWGNLNPe8nwfMm/pWUxZz+C3r0TeZ4EAdZo= 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=T1oRVPtq; arc=none smtp.client-ip=192.198.163.16 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=1707412653; x=1738948653; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T8KmXvh0YgA9eNWvtIJ49Y3WYjlHB5MaL3TkD79lAqw=; b=T1oRVPtq7PMGIWzM+VknHMyrmM8jSHoSGWQxn4tPpEpwMCLJl1Ze0qhs b3tixGLW7UwH22X4IfcDjs0B+LNCIDFVq2qaJIoRARgu1m2MzyOV/0S45 NXsDiVfXjJ0R/Pk+dxtPyVy08Tj9UDPvuLt/3q6dJgIuuLYB3wEa71VKu 5WwOZtkwP2/qwYDghRdPprJkl6qo/vDT4w97WIyM5LKfZ1egD1vXzCvnc 7oETkAUuHOTytJWvN+eYt6WYlnG/E7pVSsFHGiYiQUooRQ6dBWHM+qLa8 rrR5Ym4x41GBru/EvSd6VJ/Vzryb5104S3RgniCsRyRSuRizWfS/JLYug w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565648" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565648" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195357" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195357" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 78AF314B3; Thu, 8 Feb 2024 18:59:41 +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 18:58:53 +0200 Message-ID: <20240208165937.2221193-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790366080225642711 X-GMAIL-MSGID: 1790366080225642711 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 16:58:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp499151dyd; Thu, 8 Feb 2024 14:52:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZguBIy4LBwK59HvkDOfVf1FKJef6BFTU+6zPaHbV5kW6+KANVVz6iuIhHK+8fuIsCzHKD X-Received: by 2002:a17:906:4096:b0:a38:5f1f:ce9a with SMTP id u22-20020a170906409600b00a385f1fce9amr526728ejj.20.1707432721048; Thu, 08 Feb 2024 14:52:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707432721; cv=pass; d=google.com; s=arc-20160816; b=qg+OwnvVHOev9dylEgrORZp+0LEglrrsz62wiNiwF8VYCUyH3km56T8iYuyKvFKW8c nPYZy3Y4GJcRylEKo6PwB9j/rKOC36D/CvzhU3U9S7/nbkfAK+jdoFGI6Yw1IBEqtdBp BIJxCy8qYVKIfD13eycLlW7fYL2yY9JGnO9lfwNDdGwlL15yUIdaYHfAt/ZJlYE0llOb TfSWUIc9KORERFrPfdR5r7pKTAu+b9swJ2GFoADTwJObqcGm+ZQYZ1hbKLJcrmtpM3cY caOXG0ciOK5W9YS/uxK0Lyb+JESiyReHNdaA2y/eXQjTTxuHTfRkDAmR4T0q7mhZJX+e Hi4A== 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=XgEAYES78HqTg+lX+LUO2jPh9sGpVixgu20CRm45/L8=; b=CwuPONRMU6AM5C7LFdjQXD2RFufbFmm85x7yyP+wj5OK1djIm5tu+fUW1LvSJquTkK KqWKjBO4qYToAjHWzxg3VhUC8Dt0aNUNRUh94Mje3PHtiL/Whk/LuIfI/sCtls1ALACf OLrQR6xdaX71VuEjzm5s3qg91ed3sJWn9ZkUsxMwP55w464csx1gVzhiPBmp/LkdkHp6 +32q4wuqrUeBCUe60OOqgTbU7VAmd1IUO5jvKcrOf6HsBRbXoGdIRQRPnnslCu+9f7RU 5ApJY45YCcYdfwMyR663QQwx/BiNhBcnpCtcGcl2x1S19MOOkSe7hBc1Hi+4q8sk3U7r zUMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="PL5U/jqa"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCURznWxu5Jycql65AtaUov7SaZ9/8V/URrVVY45rsvG4lPkk06YrbZza8O0ciUQuuNCec208yyWDL5X4DxaM189N5sJsw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lo25-20020a170906fa1900b00a3bb8758a8csi128551ejb.385.2024.02.08.14.52.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:52:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58552-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="PL5U/jqa"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58552-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 0A7B21F26985 for ; Thu, 8 Feb 2024 18:46:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A688C29CF1; Thu, 8 Feb 2024 18:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PL5U/jqa" 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 7AFB0208DC; Thu, 8 Feb 2024 18:45:54 +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=1707417955; cv=none; b=sl2PvgEX4Cuoo4LSgTFfpXY8qCcKD+bsyxzZFc0WkO7ACFkL85KASlRWqRQpaLVMSDokCtX56hc7SVqRGjJGJ8XdzMk+0Y5KtSR+lw11bBqGO6yedaH0tQK80+S3cEmG3qSHhj+n0JCIGWdtCDJFnAEb7agtXUy5FGvZrCml7zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707417955; c=relaxed/simple; bh=5fFTptxgaNSrb8/J39Uzrc6cETbfYvICnOp+m4GRuCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YZaSlBxmJnSFOYEpWp+yfwccduVqjtuQZeM3B99CAYFG3wjeA27fUf2X33lPfaqhfETU/hPp321wL9jujhYzyctZeNU0tYYyjuw9+u8vSrMWIjGL5Kw3SOjU/E8gvSvvzzhhUgLEQezMe1olGS0NIRup7gMMYYxGGGM/2HyMaDQ= 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=PL5U/jqa; 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=1707417954; x=1738953954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5fFTptxgaNSrb8/J39Uzrc6cETbfYvICnOp+m4GRuCg=; b=PL5U/jqaYvanJNb1WeP9R17EfjaHTUI9mCROp5OAvtmcR/gim5r68/9q rk9Dvuti3lnxUJayJhC6+kRrTgY9lo+tHcVOiDKkhxSA9TKuh7pkm/KSR /GUQ7ZU4Fq0Hd4ibtKOExn7lbBbipDC4GgZ8EDs6+ywcC0NEfpxfL4027 YvBrj5I1t88BQvVg40HYUH+GuRTmvpBxMGIHQNPhjz/+YaEgazxKXQzqz jKGwTJxT8QJzgCq1IM6MwGKxi0iMWvR5dzkq/MJDuPT7xjr/1NO9uykCy /kWTZQXW5qId6StBSOg0PHfYqetH1rdG71h2b78R+5W4sGEQzZBI9oASf w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1185242" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1185242" 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:45:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934214462" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934214462" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:45:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 82899157E; Thu, 8 Feb 2024 18:59:41 +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 18:58:54 +0200 Message-ID: <20240208165937.2221193-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790372973130240674 X-GMAIL-MSGID: 1790372973130240674 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 16:58:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp514183dyd; Thu, 8 Feb 2024 15:25:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX26HnC/L5/gQ/0TdHIjMQuyq79gFXvstZf8jN/MmSLYcogl1+WRKeSv+krbLHt/omaR+5hhPz3Eht3YNarFjcgO2NV3A== X-Google-Smtp-Source: AGHT+IHXTdm6uyz/UfSuSANMV6ASTxsctRkbWP6wsQq1VQf/ReAwh0WHi/KRQAGQi/TKpeBEePCp X-Received: by 2002:a17:90b:152:b0:295:bc73:31c4 with SMTP id em18-20020a17090b015200b00295bc7331c4mr1538041pjb.11.1707434727695; Thu, 08 Feb 2024 15:25:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707434727; cv=pass; d=google.com; s=arc-20160816; b=LZUOrLzCfILJppMNbjoDtAu/UPuXqvWllJ/XCfjRNujv0nbWQqqXU2pWPTDC9uKL5T XGgwLKH8dMGATmQgYqnXg36R7dwqNQ3uLzcMGM8azCFH2/4QFcSKo6o4mm956kg0mvCb +AGEMWaGUAlEkrSeiTsYxh54gqOWLQbl6z9nCai2GSW2TGEVXXOznbnpa63QTZD/b2uL QcBdKrIpPYtUzi9hK/y8NFJOIBdtRHxrNADUWUnqvo7tL+BJH2N6BSy2AO47cV2QD4t9 I/l9XsPaHCseZAiNsYxvH+4RhwcfSd1QRavM4VlT1kZ6yhX77PJ92fCiekiSgTEV4CwW bArg== 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=GaNR0/EA9h09h2AUYADtw80EWot/GbDalKI2YLf5NBQ=; b=vzb+nJE1A+dDtpuazBRfUg9PisykpeS3D9YbFz3nHtOV+9Q671DnhnB9PSGHAlA/KV fk16WM13ugjwWDfUsWja0+gqc4Ik8rWnte/Hl2/PZVfwQHQvgfynFLoPUDNf5qiK8dgQ gq2JthrUlwfYWeG58cHUW7PbUTeHREpDIbhb11453zSFnagAUXFu3AqZXYNMwZORBffC 3xUIJBWbVB6TztsASFSQH6sj46BiXJcpY+01iMVqAba8gkEdERM1yW/CBYAuO3lwbyng GofDFZ0EvhswTsSuxkGA3NE9atBVWEScerUEJ5QpFKUkeKDQi43eebTZBwX8E+7aZkZ+ bMsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mfR2G88u; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58550-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58550-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXCGigfLcz8puqoqbzFIGBapY5qqAR+1clCDmcuCooWF/RN4TKg1ckSp/PzPuiVlAhuUNolz8z3IFi4w6v27vQBclQ60Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b2-20020a170902650200b001d9dfc78002si517889plk.380.2024.02.08.15.25.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:25:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58550-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=mfR2G88u; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58550-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58550-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 A53C7B284A0 for ; Thu, 8 Feb 2024 18:46:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D106328DA7; Thu, 8 Feb 2024 18:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mfR2G88u" 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 BDFC9208BC; Thu, 8 Feb 2024 18:45:52 +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=1707417954; cv=none; b=LQqWbAA3IdaTkCSDHMy6Sp/EBKWogtpUj2sGscK1af2qm0AM/3S6QIbKfRnN6ArsAJE8jnauTaf3VOYXrXHVuPfakCeBUzP4adwBMbqUd1o6weVyvyj/duum3K63ZFNPlCB36KD2BkaPcJ33dAd0FvtTDhK5sJd8M9/nxBGQt78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707417954; c=relaxed/simple; bh=xY52GBdbWlUZAfmSG2absg3scItgooHoNN72W48Llrw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EW8M91K6rxplNSPnrijauR1Xs6DDdgTaUbONEf0kBZRjI51MRnEZzzKzgiwZ7e/qZM8wrWJlxSHxMw0wj/E5r0TAJoHJ7RQd3crN4iHG/Gnzz2hdei3R8KEIWj/bx2WTgKIi/C1h7z2DEAOe1Pa143CPgqQmvSg3JiOjQYEBa6g= 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=mfR2G88u; 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=1707417953; x=1738953953; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xY52GBdbWlUZAfmSG2absg3scItgooHoNN72W48Llrw=; b=mfR2G88us051XD8UhJnDdctSAup13yIQ4RrvrOMBM3rJCu+wnkxPMZ6/ e4I85sdnZLCdNoNJNzJpEgfWHzUGCNK2bDm0Y286caroiY/cyYx6luSUX SPKw2m5UIggChvA42vI5fb7opys45t3dfehdDtJw3795y+erItCLhz706 95WodP7EulmmRkiSuW+n7xqhmmXI4XsW/JLaPf09M/oiT4W7PKFKgTb82 zogTPBMvhXdQw9zT1cTIavXWr57qwX0YX4dl+abjhUcLHdonzVaPq0qpy JLERqoYZuhD1KCn4BDzoWMnLHFjbXMFcaRAYo4A21wPzMowlSZIcUiZKh Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1185236" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1185236" 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:45:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934214461" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934214461" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 10:45:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 87EBF1555; Thu, 8 Feb 2024 18:59:41 +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 18:58:55 +0200 Message-ID: <20240208165937.2221193-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790375076865664124 X-GMAIL-MSGID: 1790375076865664124 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 16:58:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp463596dyd; Thu, 8 Feb 2024 13:30:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV1znYj+B482N58fHMP5UoW5YvN/iRlFY1OnBxqAtqiDLepwMLx4zHKuBbC5IUn1YHDDyLEA4etB5SgJQ4H0w797Vbx1A== X-Google-Smtp-Source: AGHT+IHhHBUTvVZLa/GdrKvvmNx0UbETm7EXSLzxlMjDp9ue6lJSnHmILjqCNc2TLxXJGfgV1RCJ X-Received: by 2002:ac8:5bd6:0:b0:42c:2d6c:feef with SMTP id b22-20020ac85bd6000000b0042c2d6cfeefmr614997qtb.3.1707427809227; Thu, 08 Feb 2024 13:30:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427809; cv=pass; d=google.com; s=arc-20160816; b=lM+ie99zD7jYpWAxTx9tK2XffHncQPv77XzPtvbjMEEaktZ54IX1GpSqpScLa28ZJu I1JPBDYdpMb7IozdYmlucsh/EEQozJiKxZotXi7YZF7Y2piETw9XhgIFmQTI3HJ+fFZT ElDFcriqO5z8NDp402hT0uanFcM+8uTPiNoIDS7AQCyGJIKjEzTOXywJmyaakwPGs4f0 2kThs4lYS75qgFDfGHrHpTT7XOwAH/hMZdLMo7wU4RzMLwMjPvHtp9TV9qUHdSQG2upb jSRGZmpp2VZtzsTBtvgnik0mvCvUEXwruAKFrCH+8sdauqevBJ4eNav3BPqgAG6uZzkb 2v0w== 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=M6iVvOH7/zuRbHdfHZjEf3NRaxbMNpTLlKg+ULsva8c=; b=kCvmkiVcwtFxgLQSBCzkDlU1AtuYiTJrpCYnj7wQ9ayfXgf54CQwwvuNrDSUE9rQdV H/atj/aoIdsSJb5BTGr5MeDSP4ZX+BPOHgZHzQvuBe6EIC43eaO9e4LRN4DsehFqumRG IsMqR1YwJp0BVB6jNmYv+amjC6kBH2QnWaVfxKAI3uqf6qZZKygnK+S24Q892q8CggWB 6JgnDGzsHqKJLCODVUhWxEVVNRrPaoMUV3KcAC6VaK9eyBisKRvAfm+8hVZlUgVuzN/r eOfpSgOo+3cF5HZFd9nWDG7aRcmpI8hnoRUmydi2qxKrFlvX6tLGAUg7l1pwxZF6qMwb 8ftQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fhuRbQhV; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58551-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCUvGWk19tjfCPp4o8sOorqwl0yYvHRjVRPddpwPyja1yXMSZklNMlpTsPKBeGz8BLqVlbHVzsi7Vet1hOg6OsdLiBMBHw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j14-20020ac85c4e000000b0042c3d2081d9si371034qtj.9.2024.02.08.13.30.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:30:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58551-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=fhuRbQhV; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58551-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 579A91C26D0A for ; Thu, 8 Feb 2024 18:46:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CA0A288B0; Thu, 8 Feb 2024 18:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fhuRbQhV" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 045A8208C6; Thu, 8 Feb 2024 18:45:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707417954; cv=none; b=ltluBwFqI4ozoR0I0SOP64EcVRJ46En31qmL1T9rnGpPq9yCA/6+fuaM3mYfypn3JlR3Zl0k8Jd5R3r1darTEmC1ml7MRmhozDZV2qPjRHElGACEOD2e71sKtPQbuLFI8HqQBNADg4OodpPSZ1CbUQq9CzlRuVViOVLIEIBhnAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707417954; c=relaxed/simple; bh=FH8g0LViq9a54GUNHUMfITSFf708fBC8temf69sHlcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oKjuhCbg7mHz+hgS+wT7T9AHonoelFh9SVRRrmL7AAZUiJLaqrt63V1TjzeKzyimVTrG63X8ChHZW/7DPu5IIzN5tkcJRoXKDRQqrHCbpCquqRIVCC3RkVCLT5GJonhe+eQ0p8+BFPvR08GhtsGBpsy1rnLnigY8WfaVvJXL4x0= 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=fhuRbQhV; arc=none smtp.client-ip=192.198.163.13 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=1707417953; x=1738953953; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FH8g0LViq9a54GUNHUMfITSFf708fBC8temf69sHlcE=; b=fhuRbQhVD6PU8cQoVZ5Omd7ZI/53Xf5Jy2txHZFvz5Z1m/MrNl0Uqjix 5vCot3LNWUq0pGCCV8R+jhS6XGPubm3UnhtPauK9m4OfWtg7Cu4BTl5Uf /5kpN1SLUfZjqfiQuLyznaBGMI8M1LJwvxyA9iBmUt4Ac5cNBoP2tY6Hd s/AeRX9GU+K46w+6GarH5zOuWnaVVJnE19z1zztJb0ZUEtgYhthlqRv6/ Ub9JtuhSeoXkGmEdCHh+6YWDYhNWv7NiZJJX70+01rN7fxkvfMtHL8sUw fe7kMnoVZ9LsEPCaZo9K/4CpBTeSJMh8t9nmGvmfvRxLSVkJrLjm+JEhw A==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="4271444" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="4271444" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:45:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="824919038" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="824919038" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 08 Feb 2024 10:45:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 980CF15E0; Thu, 8 Feb 2024 18:59:41 +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 18:58:56 +0200 Message-ID: <20240208165937.2221193-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790367822172210523 X-GMAIL-MSGID: 1790367822172210523 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 16:58:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp411536dyd; Thu, 8 Feb 2024 11:45:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsF9PENgPT6EwCK1f9fftHxzEz+JTpwxBVT+78NspR6RiJZ9w2cEDZS8SuZ3wrlyt8dQDT X-Received: by 2002:a05:620a:1263:b0:785:4f3b:f9c0 with SMTP id b3-20020a05620a126300b007854f3bf9c0mr523086qkl.54.1707421527729; Thu, 08 Feb 2024 11:45:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707421527; cv=pass; d=google.com; s=arc-20160816; b=M1Mir9M6hF9tySSpwmViaaqzA2GNTCa/bOZ2l8DX25OA3JTemvR8f0qNpmOxWjW6/r DNyZxCMWswfAgtn/baH/MY/P9HZJGOH+ssQKvIbc1jf5ti3/FYuflckaaDm8D3wJkrAL FvbZu1nb0Lwtq4RYvubNlgJFnSghd+uCF5FpqG4/BfP0nZHoMnF85iAUkaIquflQBWWN UTRTgN/dugn9sE9Cvkd59O2pVoXT740JHGwBvxqL4rKDFkizJWFbZ+AEjZSH39NmqQEU Np7DtIepb8D7AOsbCdXLI4AeC9/RDHftdRzvWCaaj7tBHEcjuk58rXwmiLbCcGarJeKA 8Djg== 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=t604/leFZyfzfB4eqOjTJPnJ5XHCErRjO7dfYQmYiKA=; b=wEONjMLDmMKaa4Af3WAaa7Kg0ysozkXhAbnToDHgseuRRjtCnQ2fnFcS6qP18uEjiX 6USPQ9ypHZ+EJjpMOSPnxhAEjbZFdstN/oKq1y1DIj0WE/N76XFh+wV4s0RhsF5YtNXT +KtTgny+8P4kvbYufY4hXPDMA3axIZYswbFVDVWyrLJvZ4qFxyTAPJbf1iG3CFRki+S9 Go263ax2vWJNm77qlLcsLRKjb6cuJtldfQiQ5y9BBz8yB4qMfb0z3R4iZGeOV/lpdOtJ a8Wc4J4dkz/Ib1L3rG9h0+vyTU22hIK5baXyAKo6wvXNrjxUL1jrWIGdJXKdEpxUZMHd 9kBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fVsW2fPu; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58434-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58434-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXK2yQHXLNha2GsePD9rxzmpwAN5RbYiDb2f3egchHi0o9n850/EbNTZzSXZ733SnuPOv+lifORLHyJUV9hDdf4IG2mFQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id wa24-20020a05620a4d1800b00785997a7593si287955qkn.410.2024.02.08.11.45.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:45:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58434-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=fVsW2fPu; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58434-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58434-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 877841C24B7B for ; Thu, 8 Feb 2024 17:18:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8631A82D8C; Thu, 8 Feb 2024 17:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fVsW2fPu" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 005EB81AAA; Thu, 8 Feb 2024 17:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412653; cv=none; b=nWdvk0U51g76fnmLnOK6G4Co8PK2StV7Jz6zQo621uefYVyWlYuUr1kZzm82ndOdmse7A+02NgKDt0Jmj/53G0SWwFL6usbTNOKlNQf0swdKMW/HS03V1g/oQcz4sDxbIHSDzXBQpOqr/HRd84JcnDJF5dSqhiuGgeqxPCFemAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412653; c=relaxed/simple; bh=xwQv8uq+9wANm7Kp3tnfC+qRvpRyTa5vpEt37Og3eA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q2w8G5WazjFI+npjVGfd56gLpTuZwFImHNk4+q/FggEe5ZgMk88xP9NpI6VpopSfNrRwsFqENdGYn73mnol4lJ/tpj/9D2Xi/pcZOvi8z6ywPfqKHoqhfxlglLlchpNtnnuwLgpTAPa4N8jttBk+1IULLkmC0r9DVGtu8+3ko4k= 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=fVsW2fPu; arc=none smtp.client-ip=192.198.163.16 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=1707412652; x=1738948652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xwQv8uq+9wANm7Kp3tnfC+qRvpRyTa5vpEt37Og3eA0=; b=fVsW2fPu6Wt4oEluiIUrQEpRY63dAi5Jkx3Zspqs+4bXHSQrDm6knJqW IfAtuGWi2kVtVaJoBdNu2sis9OyfS1MVDspFEZ91NbtizdM4XvBUrCxT3 CH+nA6IV70lY183aFYXMGm4XrbKBHOdM5WMDFgkdyNUbgWrKBqrSs6nsu rHSUtnNUgmiEf4TcPAlIcoAiHgsnT6+mFXGSG3yWJ4CSD6ZOE7tF6j/Oq lHmFnBdWMNaWW/9OlvizBJmNJBUF3wRNsyxoMIYtaAF547NbKQO1K4G2R bmM6SPU8XqhjEPQVLYP8myagwTUc/oiIMDLHtieoQmkY8w8Fbfhl6jEz/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565643" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565643" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195355" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195355" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A7AEB168C; Thu, 8 Feb 2024 18:59:41 +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 18:58:57 +0200 Message-ID: <20240208165937.2221193-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790354354658994363 X-GMAIL-MSGID: 1790361235873008541 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 16:58:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 198650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp515039dyd; Thu, 8 Feb 2024 15:27:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVtYXpNeARtPuW7VBR6vIuoApJuX6b56aVkim3vCppQC6wr1CCLw0BungnSFcZBOgU9CAv8y+Pl64jb99mEfbReemQSQA== X-Google-Smtp-Source: AGHT+IGfwzrRkHh5eOpzXGdMGsO6GQBxIGCmoRZmTFNC5yWuAdY2hGo8I0Hhj3te6fIG6U2WH+Ve X-Received: by 2002:a17:906:fb98:b0:a36:6dc6:d9c7 with SMTP id lr24-20020a170906fb9800b00a366dc6d9c7mr553008ejb.4.1707434859200; Thu, 08 Feb 2024 15:27:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707434859; cv=pass; d=google.com; s=arc-20160816; b=OBqli7gfE3Lk2eKMyhzxIGy3u8RJT+PbUCeEAeOYEkRRXB8y5VevqUB+F4+z4bMXfR H+C5MsaCcEtWt/JTFfOnRPW8VxGo8aAZmZRrm69gVfd/lgpNWTz5CcqiWFxoe38al7LN 7CeK9RT/x28YDF9aX1udvFepddvHlSjt/TPRjS0grTVK+sv0i/AL+CcRpmzeqmRdaMkP qE6eGUcNjmlzm6o8IFUZygM4CfC1+QvyNGDbIZWw9SOt23uh732gmK7TRwj8krZfjaSp Ak1VY2ROQ9XAkDZi60pyk2eUcdVrSEPZmnRz8H1lpSRKhro2Tb3pm4CK7gUzYzK1OL2M qHxQ== 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=Tsr/r9HKh1c0Pyx20km+ma15qf5Lw5nxch0un2FTXzY=; b=uxJGZtscYcXVxZQXuDN9SSVlDRjZfjctvgzh7U/+HsYCg7iK6/us8aN/35YKhJomqA tG0oEi3Ig7lnDgIfwQ38+O88Bz8PO17B8fASb1TJoftVB7XMhZUaK36cLnW3Xf9InfGQ zVyKa2Yyy9U0LYfsP4ybrWprdECXLSc8QlnGfwVZUt75++Z8Z82RIsPkHawyq3p1WYCg 6SS9ijL1TO+61u1iq8kqIQ7cmM+4RmQB7wr4Tp68V4HS1hbMxZGZkgYusw11g2soW5Ad y5h+ANKYDCnBN7RwvnsctkW/uwcfwwILAzYA2lf8v/qggZsvmj+qB5XKwHPRg8sd/Apf c5+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dhPfP0r4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58433-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58433-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXfcOAfOyUcvG7/mOCl3TWSgQ46XmTPLAkAki5Hhhv9EdGaVhsT7w4MFuZj13sLoeODUsN953XtIUwZPnDL2UOYMQjgkg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ga16-20020a170906b85000b00a37a5f91d11si164291ejb.1032.2024.02.08.15.27.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:27:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58433-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dhPfP0r4; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58433-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58433-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 5DAD71F29B74 for ; Thu, 8 Feb 2024 17:18:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F3C48663B; Thu, 8 Feb 2024 17:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dhPfP0r4" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 51F228002E; Thu, 8 Feb 2024 17:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412653; cv=none; b=pGfyF3dVRlYb3QepLVmSaO1J5lDiTmZNc1S8xMFtRfEG3wymDRq9Lyrce0+PEPk4GE4Cf8Kqlv295X/D6x2KOQZmza3j4CraE+jeZUIU7zf7SDo0y1T7GbTjARtvQZOHQMVEEfu2G3f8ITAx1y3GC8DoHocnHhhDbAyQoF9vVRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707412653; c=relaxed/simple; bh=v6wTWOcgnBbdVRVq0vTx2zi8kxA67Ld9K3m1TKyiM1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MFGpV7GE0QYB0WTXl0pjSC2zD9/rp7n6IpwT09as7DZHmTBilU8z46WiFU7V9aZ6r3eW64+Ty3+CpNhulhQGDGw02fhkhDR47EilHjlcBaldm0/kqfAaGf4nUU47nc+ynQ7EC7d92HOMfaRopfNyJ6eIv4UHMpwIBwTG89JEkSM= 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=dhPfP0r4; arc=none smtp.client-ip=192.198.163.16 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=1707412651; x=1738948651; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v6wTWOcgnBbdVRVq0vTx2zi8kxA67Ld9K3m1TKyiM1Q=; b=dhPfP0r47cv/qUFig/NFuKnfa2SUaYAETqttt16MJNs0lqwu/IZ7faUM WDLAxq1KwvA6YXaebERDc/fxlHResNg8WTw8gBLKdQ3A+8SXzCC8PeRha ZcYJYlOc1K95sKw4QC5fK8JZL8ASV70IWtdWw0uE0rHX+W34QN9+QIB/S qKS4D1Luj4BhMukL2/KUVdnCMQcK0vLw7LP6EFtQS3/5g2zL7LvoSvWYB tOODw0N1E1jjQuuqEhwH9db9nmf3wCe0CY8KSg/wHvt4guKF6c4dQ2Eh3 tjHMPCpnraNPmUmMHPoIAhoFeRY/ZdmNst32IkqkAaURyHt0zWcfAwSeB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1565638" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1565638" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 09:17:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="934195356" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="934195356" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Feb 2024 09:17:26 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id AD51B1584; Thu, 8 Feb 2024 18:59:41 +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 18:58:58 +0200 Message-ID: <20240208165937.2221193-16-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240208165937.2221193-1-andriy.shevchenko@linux.intel.com> References: <20240208165937.2221193-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: 1790375215004094959 X-GMAIL-MSGID: 1790375215004094959 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);