From patchwork Mon Feb 12 17:01:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 199934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp49108dyb; Mon, 12 Feb 2024 09:07:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGM3sfSK5tjHy37I0fkycn0dP25qltJJTxIRsRRMAVbjQndZKExc+PQR5eiRhUF9ccOKgSN X-Received: by 2002:a05:6102:5128:b0:46e:ba1f:a75a with SMTP id bm40-20020a056102512800b0046eba1fa75amr319384vsb.0.1707757632233; Mon, 12 Feb 2024 09:07:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707757632; cv=pass; d=google.com; s=arc-20160816; b=ffgIy4qdyRhv+NPnvz7NHirFEKvCwlbv9EjU7wekHhR8O8nFSGk03XnOcQVdfMflxQ mu93+fFZAc7qn90MruPaRQaF+BPB6VFDa/s1vIOqwRZU2VfX9wF9irLNWz2O/gWySZaA Doh1eWVTgabwTFnnd/hhaph1e8vUhebZu3AfOtY+R1vV261qhwCFmlAtg9hKZxuXLudd qZE3HK+HiNU0fCxqTfTCXYJiXwzU4/62Jxw6JH3Dce3mbdfSARlMRjQ6cKM+JMEz2QtU swMTeOXX1RMl8zLFLD3A097AtImPKaKe0zME6CmYwDFs4b0e2SxE+fFryGQHYE/035yX 99Xg== 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=/4HG2ot85cwmhvjE6R4J3N8e7HRR7XjtzdU2RLo+tAQ=; b=GgxQqypKQvxKuzrYBeG4+05JF/AgUlRl7JwT7Pka75snCeKcDb/r3f+TSQT4v/2L92 2Vu090zt0HNkkLdgL9j0MMJ54fiH2F1eSioHL0j740G37E/SKdnk5Mpen1KJNuFjt30R 8uXll3o83vIjaKGpnQYRp1531qYLtD5RzjXZqlR37RWEYcozVvvYdyooIAb3KzHu3Hef eoHpKLsNBPQLWQmIMm3vvYRArjjKvyxMk1LAn+SvtCPq01X5tjDNkgvm3GaVXMN+40IA 68/oGypRV4/dDUeNxzGyMznauQKdhf3lDvphQYXky9E7SEaXBwGlBy44gVFQiq5kjy1W FYHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A25fG6PI; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62041-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62041-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXCwPZ0ZprSc5ch9uVhZYBnH21qpJA9S6E+dWH9le00GAXKuPa7t5lB/Ow/PSApJMzxQU3XlmqHChFifvuuzrgnyIWK6g== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m8-20020a67bb08000000b0046b33badcf3si720274vsn.792.2024.02.12.09.07.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:07:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62041-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A25fG6PI; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62041-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62041-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 052481C21BA8 for ; Mon, 12 Feb 2024 17:07:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF4A745BFC; Mon, 12 Feb 2024 17:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="A25fG6PI" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 946363FB1F; Mon, 12 Feb 2024 17:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757490; cv=none; b=nj5TVjaJJCNU9DO3q+h8Z+jWius5BALxS0vGsdflHafzcnDs7ZM7PAOtJj4SwQX7hNPIr3qiJgvKpIWUkGcNU08AR6Q+LzIoD4va1GCyY/zSeM3eh752xxPJVVHz64Ujr3h/+G9vpVG5zWgZ5vYgalcV9i1+09AWQca1IB742/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757490; c=relaxed/simple; bh=x8TByPmOrQ+gMAIIaoMyZZvfiNw4po8E/dT9novu62c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tX5/9Wu/tVFGBTRY/QXm/G+Zy81B/70aadyhvJ7x4xQQNZGENrc/PjkUKz8ogzdGrC7Z9R8BAk6P6YJLyem8NeSC/8+rKYwrqIkxOVPFeg0Ya7lgjDsFXS0K6EbgxGm6e02Q0kXjw4mNcjgPj1cXpSvM4t4UwDxXrzAcV1vdzcU= 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=A25fG6PI; arc=none smtp.client-ip=198.175.65.10 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=1707757489; x=1739293489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x8TByPmOrQ+gMAIIaoMyZZvfiNw4po8E/dT9novu62c=; b=A25fG6PId2B6nwDtMnvawUaaTLhcRTGYoUkAeypqaZbKso93/mihPwBx kDKSpdeLCor/aL6ryPOPQQ3P8pYlUj2nZxP7OJQtxT5gCaHNZGfz/exkN xCP+dOkd1PaGRv5VS4NeVrGuLXOUjcSBpTQusvpRVQNG/QxMIPW7I2oWM JYirSHIeI5SCsyqpivT3H0R5VYqklDms5xsHB9cyofBGY9BaD0SrBlkGH f0qIghZHHU7BBNuST1+uNMwKuewdvG5Cegu2JllCpfCIhu9CLOr6lI/vL zGNC69M5YstUFYzim5MMPcjSAEFWW0HBHKycFF3Qmy9v4AyYfdSR7M6Q1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153170" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153170" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116808" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116808" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:43 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 90163A1; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 01/15] auxdisplay: img-ascii-lcd: Make container_of() no-op for struct linedisp Date: Mon, 12 Feb 2024 19:01:34 +0200 Message-ID: <20240212170423.2860895-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790713667186223654 X-GMAIL-MSGID: 1790713667186223654 Move embedded struct linedisp member to make container_of() no-op. Signed-off-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven --- 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 Mon Feb 12 17:01:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 200040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp177384dyb; Mon, 12 Feb 2024 13:29:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVVSovLEu/k+J2n9JT93J/4kM4swNE5iyqPE3KMD7ZDC6o3lzf/jhAmVwbyaikr9SYDPeStjPXSOR8qTE7647UGE2tf6w== X-Google-Smtp-Source: AGHT+IGOZ/nNSZLPWQki2CZosV0f3TGVRw6Dcyl2TJMThEOjpGkQcg7GOqyfYwQWjw+1i1OlHydD X-Received: by 2002:a05:6e02:1a09:b0:363:d96f:6850 with SMTP id s9-20020a056e021a0900b00363d96f6850mr12045787ild.12.1707773370225; Mon, 12 Feb 2024 13:29:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707773370; cv=pass; d=google.com; s=arc-20160816; b=vVUb+UkzGbjSslKm1Ymw0Nb+fGSyFERzm451H+Kgfl4UojbJwQa12dIzPDtIpKNnns i7dQjyGwFel26z4Ta3R3fsbGltF8dnCnCLX2wmlyo5/+B081vnJdTrZ58HHSpwYGwAEy X6rVfjLnB7l6qNodBrspnV981nPg6i7QL7oqbKbNpR31Xvz8m2oymhO75BgpV6CS6dKp gdYxKYAHqeTDk2Px12B4ugIPH/lTssjQXrrp69fwBkdqpf9DTG0UwXKJupeRKE+NPy8L KRsbpSJdXpM3qJQxd3Z5omeopHM+xLufREjwrh5X5zGtplTThysz5sNbCI1Vm7cLMPOf llyQ== 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=yGNWUept+Oa4jCyw43qeLKwJkViA7k30Rzd0UHQm9Ao=; b=QwW/hHrDUfeTQop360+W3wnKKRGwPkUJCLTBmOVuGOi+zyubj764Cgfllaq0wX1dKQ sH4OxEQGp4GGekrLfRUR2C+tnr7BqFvzBbkUTPYhJskjy/n8kVmm+0FJiHZXXCDdY337 57x2z4m/GNu5jtIS//xy7ap8UL25zH+/ucy0xc3A3+6jXbG8b4j7A6QUiUgDeQHRGsAb S0j1C3S7npy0k18TImuOYGmczvv1wfVtpcof8BScGOXfGyX6qXDgM1VD0UzlhMxkHabJ +nrf2pRboeyKQA2cH7ej+qfgtjSMmWmo877+B8PKerovnxcTFNrtIss613f4xjO7CA/r 2XFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ketLq/a3"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62042-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXs6fMDlSFiACB9DnxfujVII4PP04iJ74qWB/RjUtpCvsd2uPwU29ea71ldnmPGhOM2zRCSVKpMhLJRy40qNzLBxvIFdg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b19-20020a656693000000b005dc80a2a308si264698pgw.436.2024.02.12.13.29.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:29:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62042-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="ketLq/a3"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62042-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62042-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 AE82BB24A82 for ; Mon, 12 Feb 2024 17:07:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C57B46450; Mon, 12 Feb 2024 17:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ketLq/a3" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 ED4723FB31; Mon, 12 Feb 2024 17:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757490; cv=none; b=HaSzRab7KNrFVYTNBAp7gYOtcBbn1F/CzvxApm56yxtsCwrz5zMP8pOJC177DZDgmmFZx6QKLK+8XvRWuLBb5SBLNba0+qtqFPLKLls4LV/Dp96geNj6O/LLWhTUwXKIpe7cY4uAualE2iJ627OqPhtqJGxtgTXfhvnTmk78ia4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757490; c=relaxed/simple; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BmRvP4d7/vNvkSY7QMUGt2NJoScmwgAFzKmu+cr2La6+7KO2EqXYE4RXmSrpM98yKCaHEa3ixijaSTzLxN7H38GmoAZW+jjvGgEc7cDgl4bASksc/0FP0gqUmNhu2NpzBOHQNb53WHf3Lc+tXutT5uUEYclUD0EjGu94oQSMrEk= 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=ketLq/a3; arc=none smtp.client-ip=198.175.65.10 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=1707757489; x=1739293489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HmO8BJAxHzacI5yK10Y9+ofU0L21g/VbhUyc1S5/3jg=; b=ketLq/a3NPAg1xAn5daJ/9KyKS+d1J/OMYrQYZdJmj59VunTrr7S50GG TCe/ro6R4Yt09v8Ox6OnMr2b2sLneIN1BPquKEmooy5mizmA+MkIwdpzs BuQumifUNwpUhY0W1RfmrBmV5eMKUiPdxH8V6WJFWUJZJ8McTXKS5XPuU ntYYZyCOUS52IZEDiPOOsWkfPvp0bws63q09qQznNxTK2jt0y69Mh/RmF vO7Jn1cn236B68xSgkzQ3USBn8FRr9Rf2VUS7ifIpNh79ODsdK+5CZYKu sCaf1lBT/Aa8KGRL/yf5sEg4+yWMkHLEUAANfodTwtzLztUPz6Pd94MKh A==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153175" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153175" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116811" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116811" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:43 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 99AF2FB; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 02/15] auxdisplay: linedisp: Free allocated resources in ->release() Date: Mon, 12 Feb 2024 19:01:35 +0200 Message-ID: <20240212170423.2860895-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790730169381795206 X-GMAIL-MSGID: 1790730169381795206 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 Reviewed-by: Geert Uytterhoeven --- 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 Mon Feb 12 17:01:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 200033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp167883dyb; Mon, 12 Feb 2024 13:06:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW/RDeoiaIOLq/lA5S53Cb1M3Z7ieyOQgnYJo7Bn3NsjTEkqxWbuwfgFMimgVqxb8IL31HA3lzQj5s921X800BRjoMaIA== X-Google-Smtp-Source: AGHT+IF4ElqX0RphEV3nrSrmKUUMtpGmY1tO+YbRKkXy9b6VwAy8gsavn8jm1xUunI9IPC3aRnQY X-Received: by 2002:ac2:44ab:0:b0:511:87ee:297b with SMTP id c11-20020ac244ab000000b0051187ee297bmr4220719lfm.53.1707771990807; Mon, 12 Feb 2024 13:06:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707771990; cv=pass; d=google.com; s=arc-20160816; b=nVKPP/8dssN2KxloirMAF+6Fw/JTAngydZ5AUGwYdZeiHv5fVi5WfaKw/foE69tS6B Tbnx62B1hIx61eiLUhG0mgUqskK3oWOksglzgXmKSwllk8WlTgC5S1oBEyWR4BkVpO2W T1H6TGQsdm7bdx/wEyThFZMTL60cHvMMLTird9/BSUgYCo3NDY5HtM3rxl41z5VLZmL9 Mv4orkk0mZwtXyA39AmjEQp2G+l77UnOsuffzrmCL4Dcy8Q7jol7zxCMguy4YKGRwPou QJ8BvtRlMR8wgPBU2zAIOx7c9mNeX5AGu8Pq8dPRjgpYPoT6V4RMxM/2vkqnfD9la30M vzpQ== 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=Je8GYmrgtI9JGGHTJbNaEkFa2xxZoiECpzF7sgUeGFc=; b=LQyZLgZy8f3diNk2IjuKUgf6URxVBby8J4bJV7EMHa1SUcYY3wgIay/cFeZcZZTnui 3rO5RkP5zdIDrGn2XMef4hsGO9IzH7vlsD6fkMK5f/C9N84EMNhDvkn+yltE7cfDXxqb 1uX98Z4ngw6ygcEjN6/Bi5ddauByNBvPDZCFCJWVEL6xW0XOWhM3IDoaAPkuYElgSqzC ilIbbnyEAT0BR4KOlM80Ke8VpIIhDKsA31IqNkoMqgrHZzQZQ0A6O9U9AY8cojroT5YQ w7lXBA9x6YIqV0vtrzdpW08QAnLinrlsx3ZnPzkXyFOylqWQ0Un+YnmddN3Vup58f/ED nayA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LynqWGE8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62044-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62044-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVxAilXr5pHhgci2jaBT89wx35fRiEL4YgSB8wh7FO5EtvvsqZu8cWgG1wrhvXR8ERYZeRSkBepaMYLBJm/4WljL7n86A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g26-20020a1709063b1a00b00a3cea51e75bsi239751ejf.788.2024.02.12.13.06.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:06:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62044-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=LynqWGE8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62044-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62044-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 4FBB91F286DC for ; Mon, 12 Feb 2024 17:08:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42854481AD; Mon, 12 Feb 2024 17:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LynqWGE8" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 320323FE22; Mon, 12 Feb 2024 17:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757491; cv=none; b=jq9dp7Qt92Po8mQk8FqgWD78dkEer0WtsgPZxIjwHACfS8tjcGkY2vgJba59xMtPV4lX6qXA/fJwEal17yKLhZUJk73dSo89R49qgzmf/3+ORcgP3OUZv3bjuQkIK72V4//LAe0hMzc0nPWqZIozmON61oqP2K1rOhuD9rmGcBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757491; c=relaxed/simple; bh=LvC0jNLSvlISq+pfX0tunOut+CloWPeckMMVxbBHVes=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V3rgEtMKZuVG/l5tR9dhdb1uuJ1DH+cASQn/oUGg4/uL1mAQ8Ii0HUanVAAFe279TkNjOlBHAKvY+D+uZ2+TzNCS3R2BqBMA9ma9OmELGB2YLM69Jq4x2HMvkQgvu9QTcYPs8KeQN6+F+h2XBk+ksewdIzF5FYuyGoyb6nszi2g= 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=LynqWGE8; arc=none smtp.client-ip=198.175.65.10 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=1707757491; x=1739293491; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LvC0jNLSvlISq+pfX0tunOut+CloWPeckMMVxbBHVes=; b=LynqWGE8tHLRz/g63tYhFPvqI082pSK9xAdvxatg9Rpw86Cpf/Rz5+Ng 75UUJhizNmy4peZTrH38RDKpuf/emAp+SU9YJCBiN3QA3z0/o/whpNBmK zhrMUHvgd59yf3EoEyQ3sg07xbv6SaIbWoVcUOFhnArn9jfb4Fi9u+iEw HNijb5arUW0Gs8PW5XsmfxKnXYgqIW7vevqruwHSLTOoKcnRWi7gmT7Sv /QYkGczvfRbrjE1gApJRx2evkaUNZ2fB7BXlPYiQOZgCPFRbz2xInuEJw lFMRY6jiuUOvjs1mIPgrlgnXPnR1fxQvfKef1H+29xrmOlNTf//7DUQMR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153187" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153187" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116809" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116809" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:43 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A9268138; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 03/15] auxdisplay: linedisp: Use unique number for id Date: Mon, 12 Feb 2024 19:01:36 +0200 Message-ID: <20240212170423.2860895-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790728722818555155 X-GMAIL-MSGID: 1790728722818555155 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 Reviewed-by: Geert Uytterhoeven --- 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 Mon Feb 12 17:01:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 200032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp167822dyb; Mon, 12 Feb 2024 13:06:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVTGqU7evLz6UAvbe3S86DnuSPgfX2PSJjpRGL1IvelQuqo1N9yvk+NeLNkicv2S1AV3JSa3RVUXcEIEJU5z4Flz9rZQw== X-Google-Smtp-Source: AGHT+IHEkPjsDis7OFWBeyN8sIIf53e1Ln9umDHHk+VPDE6Ew9oOL+C8d19QJrfuXU+XG+AdAVZS X-Received: by 2002:a17:906:6bc9:b0:a38:41e8:14eb with SMTP id t9-20020a1709066bc900b00a3841e814ebmr6075362ejs.26.1707771981598; Mon, 12 Feb 2024 13:06:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707771981; cv=pass; d=google.com; s=arc-20160816; b=kMyK+qgQzWpJdKpJ+Urar/nV1gZS5Q44hR4jrG1MflIjiPhaI8z0TKe7KV13ZGMf0F DER6CP+dqST6KZNabxG2MdQufjFdOlnRl4d60JOvwhZo2JlmJv00QLw+g7ajKpoeq/m6 CngxN/vDIhXtp8y4FlvG9sbwI6k2CNy/Zz960jfD7tq/mcAbUuo7oYyXr0IfRUudAi7B fgt5RdH7EFDTKv/QJyBwOPl0Kk14U/zqqOzD/C8oxClKxYzD7zyF/+jiCyobjV5gtPjY eQk5ayQp2vCZSQLmuSbD8U7OwO4hhurNMa+0d/LnJ7OJ4+NxryR1i8x3sSXahRUsAynH zmOg== 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=94b+v8XysJRMfZB5dwHYGqq0/1Q3jnD+TabhPwEZtw0=; fh=kKVcQcD9pvly8P9Wtn0IXnh820Eip29CjF5uMfvN+F8=; b=COmQCCho5gw3Tp1ggRrcgn0g/LqcnOfKFZq4JuHzjiz8QhhCPRssgGiXE+G6HAYmYy F+FCZMIKT/OGI8MWegbecewIqdfRNMc9yMkZEl9H0rQSNfQeAwi7WXrClKLcjHsiAbJF qU1zP1CuJkr1Owy0V/2eqOAgR4m4V0LkjMGpVEvKQvLd+gP1sI/bsB5Dh5EGbwp5Ev4Q NhV2UW2hXF43OjOnwxVrs6sKu5K76fYJ/gyDQEGOyd/53Wi6u2cmvaQi0Q2jY1TMXAjV 7sz9AE22KhAETGGZ353hnTsiQGgLiR750VHHJACbJIg0JHIi5f1042ihBYeObIuQ8fal JhMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eTZdTodF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62045-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62045-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWj/AuedRWrha8y1owBAaiIv4oP1yQzVxoxKEvp4JMACyvYSGXq5BhkSaB3Lxk6XVHSjKK3EWytLdg8P/W64ayPKiagiQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h25-20020a170906719900b00a3869d03d13si515905ejk.610.2024.02.12.13.06.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:06:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62045-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=eTZdTodF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62045-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62045-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 797F51F28695 for ; Mon, 12 Feb 2024 17:08:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36544481A5; Mon, 12 Feb 2024 17:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eTZdTodF" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 552C83FE2B; Mon, 12 Feb 2024 17:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757492; cv=none; b=RXFvdjon08wvdcmCjKlG4ZcdGuR63rs74Jcivm8P0q2gFVhb6xIb2WJ2y2L8enFYdtbRtN2agmYy5SpnRS+PmD86qfUdu0+XA+gr0Rs7dkcq09+WH0JWmpZIIcETLCRiPnnzC0QYvdJPNA6GJr/UXqaocSwUXhrED82nxb2uQbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757492; c=relaxed/simple; bh=2toHElackSZZyXwXNBaTI+oFom4ViAe7S5c8+PQ2aGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XC5Lp2SnyMqAmVACPOWafl+8lDQwZczWk9kD9mH0nDd3ZAoDoAOZTAco+f74XJRe4aVQpEqoFCWrLs10xud/Bhk/9GFgRlsPAKx10iOt4zUoJTUM7jkEVKOUP35wjxOlvnz5n+7Fg5viZMXwyxOnFGvUyCANZ4RhRL7RmG4+2cY= 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=eTZdTodF; arc=none smtp.client-ip=198.175.65.10 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=1707757491; x=1739293491; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2toHElackSZZyXwXNBaTI+oFom4ViAe7S5c8+PQ2aGc=; b=eTZdTodFSzzrKE3Dyd7YeTDByOHRyfJETBTUSYKLuwXoHslyTZpdaMjC cZozG2DjeYxWceIDlYUXx35BHDY3X1cavzsa0wA9iCSbjkVacZCM11Fkg vSkUgJUmE7Imv+9ZWT/Zq902wVtzU2vLRyhl7xFnkGsrxakNhRy3esAKJ /dOXu0+/7Kpl83WCrdLbXTBtBUuPsSPW6WC/GOSuu11G5x9JyAOKpObh6 aL4Pv/Nw2u+hD/1FdkQLR7+VryVKcpRb0y2hRqdm058d5T17lFsgRoUSN xQI2rE9wmSVSsDWzlbcithvfTDnLEDGw4+9nwciuOkgmBzPgPT1XNgioW g==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153181" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153181" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116810" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116810" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:43 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id AF1E911D; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 04/15] auxdisplay: linedisp: Unshadow error codes in ->store() Date: Mon, 12 Feb 2024 19:01:37 +0200 Message-ID: <20240212170423.2860895-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790728713092879724 X-GMAIL-MSGID: 1790728713092879724 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 Reviewed-by: Geert Uytterhoeven --- 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..8d91c2099661 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 err; - if (kstrtouint(buf, 10, &ms) != 0) - return -EINVAL; + err = kstrtouint(buf, 10, &ms); + if (err) + return err; linedisp->scroll_rate = msecs_to_jiffies(ms); if (linedisp->message && linedisp->message_len > linedisp->num_chars) { From patchwork Mon Feb 12 17:01:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 199978 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp93371dyb; Mon, 12 Feb 2024 10:25:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWwBgpdYubL2gFgZGwlxyZt6Y4DwdXhEqmOsZpqcYqdI1QFFXSC12SrazgV8esHWbvm86k4jsB3epnsVV4PQBUZg6lh1Q== X-Google-Smtp-Source: AGHT+IGE8ImtrBIOICD8wgH7le3VH8eRlOzpX7YjfYlWni5kzrpZqQGYQq70uU7dJ27wmPjsfD4+ X-Received: by 2002:a1f:e6c1:0:b0:4c0:1c20:f827 with SMTP id d184-20020a1fe6c1000000b004c01c20f827mr3801878vkh.8.1707762322305; Mon, 12 Feb 2024 10:25:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707762322; cv=pass; d=google.com; s=arc-20160816; b=BPY+hnuD5c0kXapZh4FUtJ+Ooxe83qy+5TYck4Ghgiij9oXhOpAMcZp+3YZKt94Wtb qV7ow0QWD16PMQYKDCsmCP0KaDz+C3DbIHuyLX5L5KanoiSzJxsm9Yhn4R4hl7YmX0US GdPWoELyJo0hC/MWRcYMyNrc9c99JrR6vUF3eIS2rWDhvDBMa9i6fJtymACMApHltda/ 7ut+Y8LJmLf99yTuvGzujKjh1ofIz4FMK1+pLnjyMTvtuf592FrIBMUyA1y1u6cESPqk UnpR80aGJzUj6gvLm7nisj1Nruuwg5hGyC2sBLZGA3wIIO11T1vNSZ5D0jxF2PgZJNcr /BgA== 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=98aPRq5ZTYONF8ilwFH7MQIAeX6+Ef+x6lDyYdmVIsM=; fh=AdKn71FK8pGr22INwW03eZF18XW5/pixE/M+b7KuUgY=; b=ftsbIcsDKIjqwHlepUsu+lQp6/FOXifpxzi4Z/GY8BRd0QlWxomiwUqJqyHz4IkLEa oy9BwldsC5a+0oBswi6nyysNTdAzKXKA1MzRq4iebk5b4SBwK/SXo+H1dPY/Pz2IdD6x pGrSheaoFED5J3/Kky+AKEOt5PfrGLd7t//hkfea/S+n1RNiwhvmAQPEojP12yTHa6QE yCPVAzn4zfvtmFhyXFzRvv608ZhR4Yp0e2PRyMWuyr7DFq1Vj2/RZG4xu2zlX2oWPHSM CUQA8v8S/u3EQF2BtEq+qV1fLhBnvYW3ZVOLBXCI9S3srd+RoUS7JQ9uEibz14YjrNTu EP8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d6CtesN0; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62047-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62047-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVNLbbla4BwriQDO7ekvIxm9BEAQXpDxwTcISDNOR/e+czSyLhq4jMOzCLfAknmDPGsTNpKIGxp7zm7SJVvjqZ2JIbnQg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fn8-20020ad45d68000000b00681991637e6si1019727qvb.484.2024.02.12.10.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:25:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62047-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=d6CtesN0; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62047-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62047-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 EB1511C225C7 for ; Mon, 12 Feb 2024 17:08:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0C6B4C63A; Mon, 12 Feb 2024 17:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="d6CtesN0" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 E6D3D41764; Mon, 12 Feb 2024 17:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757493; cv=none; b=MqpjZZ7pQklLXUzOhzPCxmkSVlS2EF77AyKtlYG4gYEk8IQCtOUYbfjPfNXmNHSdEsGXYwXjzPOhLMIcObFcHPCxB0N8qy/A+4xHUpjH59dSRQu4ltw8p+dx50QmffPgGC+pAMtdplBXdQP+SP+/z8hFMdr5fVA2XHvAESHNYh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757493; c=relaxed/simple; bh=T7Mp/G619hZCfbmKq4sfu5Mlrc26ZVC0R/tzaJ91tuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3OVrSN71A1yvjODEQu3A/jmRgZe4TRmCjBdD5c3vFG28wyhET9tFLU4JN2Tnp0Giw9/9nGomXSvqsjXxP7mnlry4rmPZdKprHC1apBiPoO5ZqGQC1WNNFjly9KB6OOazYC2Q54wPcIDH+1eP0Wh+Gu3JHoG7aRX1WeNuXWjhcQ= 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=d6CtesN0; arc=none smtp.client-ip=198.175.65.10 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=1707757492; x=1739293492; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T7Mp/G619hZCfbmKq4sfu5Mlrc26ZVC0R/tzaJ91tuc=; b=d6CtesN0w0FZKj1ZTZ9lc+9xsf/dP8IlKvnpU3iVmD/ML9Cduz/Ao7jp gLTuodxN4MJU6rhhltsdvsI7ipBaL6FvoQ6Rgq6n0x3JSJ+k66WZZIrF/ wVwjc6NWLN/B89lHZCxWtew1LpsDnw08xIrZiCTj/Y+vlaYfLdeGWLP7d ZCuQ8fRXv5+tFNq8/AF1y+o+zqY8dpq35c9/7zsAw/zgxrrRS5o/pvyR8 TXYnGMjDxa4Qcs8SbhoumGG5RoPPxKjdamaHCcA4PnDha8+0S1NKzUB3q 28eRQ7UIaHHEeKwb66tntCg9/BNDjgfLBV247Td3y6MkhbXaRm7Tf2I8d Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153201" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153201" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116820" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116820" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:46 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C465D204; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 05/15] auxdisplay: linedisp: Add missing header(s) Date: Mon, 12 Feb 2024 19:01:38 +0200 Message-ID: <20240212170423.2860895-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790718584745389077 X-GMAIL-MSGID: 1790718584745389077 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 Reviewed-by: Geert Uytterhoeven --- 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 8d91c2099661..a0339e4b5939 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 Mon Feb 12 17:01:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 200085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp196969dyb; Mon, 12 Feb 2024 14:19:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo62UqxslCb8Cs+MxLaEbe/ypmUTedeqUBrGJ7WylJX4t/yTe2vjUrVCrEzXGyGzvf2uV2C2fWPHAf2vQ1jWs9NhPEOQ== X-Google-Smtp-Source: AGHT+IHc5Um5YazoetHaeUDNII9OQ5VjDwNWZPRqShib5pOVyQMhqdVLvxHskKPA3wAFnVmEA9mm X-Received: by 2002:a05:6870:970a:b0:214:a070:cba6 with SMTP id n10-20020a056870970a00b00214a070cba6mr7237302oaq.49.1707776373373; Mon, 12 Feb 2024 14:19:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707776373; cv=pass; d=google.com; s=arc-20160816; b=wTFRSLqA4ZkWlS4egz5UlJTqkxAJU+0dX57/pmYixGnncjNdFajmuzDEpd8neyrRUR DB5CS88tk/kF37QWSQNu/c8du6QOv6Q30ilOOXDh1z01Km+jXD7KU8dtFgE5AfGNJM5y Upqr1BzBq6v26aPbOPsTjgmmDI/zlJ3bnrWNKMoh1JY+M92NkEvkwR+RyfDzJIUAEyXE Bo9N9631/nGL0vvKy064mdCskxjaLXe5/gYo6jxOqVpHdzXJ/GmOtCUvW0+p3NxYf7Kc r9A3Pipy8fXCYdv1XPY7G6+YefG8B611FYP8frnBQhkNp/z+dJB3+oLUeoL6c83LuDHE 0zMA== 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=MbsEyFVcBELD8tCmnGYow8mLULbkTNg/rkGY03A2530=; fh=m0GVUlBDiIax//plMUvZP88iFYTZQ/hyABCQkbAVYJ0=; b=AHvAwQzyEGxmBtQt2ZiwMakpgXMW/H7I7ZZS7429VUyNWP092DrcJnGOH+ruXL7XZP niz/L2BQ+WNOFY9WyyDJcQZUt5nXwlk6IGtRplZ2OPo2fBvhODqcISxJtaG1mZCf2Quf 7pO3onfeods8d/wu+nKY+nfrEG+HDwRsAFMBMF53rvMMkNSBmPGaoNmC599Zm4mtoG0n 00iu8Y95PwYAivQibBXai9MrQpRNWXBeBKO+C8zfpOkSQDNlq12a+I5HvXRbr5zRvV46 BEZU5tLjJNxU/GZIkGip0XVB+3nh3YJNDqIo2XQfjI44DWIrQP59i17wgy0H9BcACXHY 6S4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HdbcK+O3; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62050-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62050-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVd8UDkySVfEBpodJirLxTlyU94pSMUXRb+JFEvM8UkA+3p9kPeMEyC2QWmcthqpl/jsPoQAI7tUGnm3GlEEF1rxKoQWA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id dq16-20020a056a020f9000b005bdf597ed49si876601pgb.56.2024.02.12.14.19.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 14:19:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62050-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=HdbcK+O3; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62050-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62050-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 E71ACB25016 for ; Mon, 12 Feb 2024 17:09:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB5114D9FC; Mon, 12 Feb 2024 17:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HdbcK+O3" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 9F7A84653A; Mon, 12 Feb 2024 17:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757495; cv=none; b=mZBMIZptXxtkX9hBEgwqtWxYVgNtRPn/AN9lBvMnRTGvLcnib7rvdW6z3ECaE9eWve6239WeW8cx6Zg2nIIH4J7s04FbXZXn1m4DPO6RYO8kXQkyZlOmCaRLT6nY3Z68nECqRcTbm3AcsMUfq6AhoGiG40k30fo6pmDL4/t4VE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757495; c=relaxed/simple; bh=bXuKJcg7HA+0Vb4HJgUnDZd4G/OsktT5Y7OPT252SMI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p5EhPTuapfMLiGazIAo44BD0LSOtSyyVca7OMkHtZZ0k1udGVMA97uyIB2Z4/BCVUetKHSTvOe+syNGPq3vPf7r5fZbT76qk+KMBxrDymnnHM6MyIHNiB5GWFrNwL/Tth8xzdjz9orYPVNy2qEc8BSC8dJ6znURRUxwdVMT2VD8= 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=HdbcK+O3; arc=none smtp.client-ip=198.175.65.10 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=1707757494; x=1739293494; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bXuKJcg7HA+0Vb4HJgUnDZd4G/OsktT5Y7OPT252SMI=; b=HdbcK+O3YVj012egshvSaE2a5sx00TXMmyLj4CCAeJKIEyuenFrfwD4G 4EIPQ1/157D3F6lywrt4DAya+0UxKk4eGLfLaI6G4TNTO3t8L7/UFghou sBLQa7TAZ9eHrLzx/n++kTf9DJsg8LT8mlqDdqMNFnvzcsAfOGVqp9jQd GoHcEXU/ozV01DXb18qAZ4chlN5zJi7kxptxZz33ROrw4lgj96eNmfLl9 emWaAnFfuS6o8YLrjCQbo1LsFAf0PeNLb7FqeTXZYzCe+u/XJs7KtpH4J KhOd+DTEpMjg9L2G2RsmoZZ1vN21gbpN/z0ugsHaOTiaZVlyi3kpeejyt w==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153214" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153214" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116821" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116821" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CFD172DC; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 06/15] auxdisplay: linedisp: Move exported symbols to a namespace Date: Mon, 12 Feb 2024 19:01:39 +0200 Message-ID: <20240212170423.2860895-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790733318639414752 X-GMAIL-MSGID: 1790733318639414752 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 Reviewed-by: Geert Uytterhoeven --- 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 a0339e4b5939..8d0ebdf0f10d 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 Mon Feb 12 17:01:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 199935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp50657dyb; Mon, 12 Feb 2024 09:09:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IF28vdFhgnXtl7iF8ZF+ME6cKZHx1MrysVp/QCf85FY2sCUBhsP4WkA9vxbFvtpdx6b1An/ X-Received: by 2002:a67:f9d1:0:b0:46e:c752:16e7 with SMTP id c17-20020a67f9d1000000b0046ec75216e7mr1299851vsq.24.1707757756215; Mon, 12 Feb 2024 09:09:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707757756; cv=pass; d=google.com; s=arc-20160816; b=YSVk0dPOqErGRC2l3yJhhNU5JxakNpZYqAVcHz0d7syRqiGlNkemnj0kaVue6KQ5Af 8CDA4AEtm4E5BMM7jrq4OjFWS3xROSH+RPdM/1ofNO9zXINIUxPRPXdqClwBnfutKCRa mjX6J039pHUVExrSRNjPEucdjtg+Ie36j573mFn62QAyf6ckx/RYaY3UQYu+EohuEiLY Fp/301ANuuwGh4+KQzlgl1/DwoqHeyzFEBlDCH3jRPjiWMKl9xpVSws5Ebr5+TdIV3s3 fQgX4wqMrKMENCCqFIG3bv82WLKL0hVii/LvY05+j3kR8kDKdvzv2WPKDLyaWb+ewyWa U49w== 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=EKV88bilhXOVNY+Mice1hFweV85lBwa8NE6lgWHiNAA=; b=JKZO1jWv09PI/YzmH/KV+4UDQ5caCbTA0oOZBGyjiDAb/a4dRHavTAutj57dt96XQt CQP62nOuKGk5eKv4zGbaKdZeMD2ZIKZ+xVNkOnxh40FDBsHFGXUiHChj1ZcscSTCswra jDgB5LCmTm52YobUI9rligE11B8+6Qhr7rnVmGzmaYBIeiF5Sj6U2hOjmHCbRlX6JUmu cOM6pVjl8NfHjYt9z65NA6NVJA2hQgWtlv0+Mw7EupuNUrkyz+7akGShE4p4mbxJbsaq TDDmO1Wk/pFrLU2KxI0tfLOHw9jz0/qeon8k1N/13XjQPEdYTiXAiHDNbXwUHOV5rxxK Xw/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="k8LV/yz1"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62048-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62048-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCV63wXWR1NssMK0qPP17amhB2oX4RBG/entc95G7jvZzEVR2Fyn5tqLSq7Ld0coHr8pxeFIO/MBd62PLVO3DG5/1xLK8w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j12-20020a056102000c00b0046ec4bd20fdsi227647vsp.208.2024.02.12.09.09.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:09:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62048-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="k8LV/yz1"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62048-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62048-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 E85EB1C22678 for ; Mon, 12 Feb 2024 17:09:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A78874CE17; Mon, 12 Feb 2024 17:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k8LV/yz1" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 5B4E34596E; Mon, 12 Feb 2024 17:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757494; cv=none; b=Kf2b5amUD3Wj6dby25Io0gbGmy9fzR1D5O7ZVG1TmerwFTIiR9S2v2jU4owar/uQ/MtwzCWQVgadlxM55k5xwNc9KBmYwnOoGJ4MKMaKAGSOSzhpbVQWkRJZhOI2ujcRsb+OgNEPaRKcinis0pjM7CPZsAGZ1ZpwnvE2VJwhIxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757494; c=relaxed/simple; bh=Fg8HFd6qXwgrRuKizTmdQy4zN2vPEsdI81OkVtdnatg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cPJPzsgZxMfoq78W8TUUy+ykAqnI01KpHuxCj+0H3E0BPaHWO8ZFEWWIf0uDgeY40wkiF/uss/XbeMkMiB7QKrlv6gQ7WPfHXwzGcVHHPRwdOgSOM8GrR74AAmuRefHSZaNwp5qBvfwzy+LDwTcPpTM411ljiOf43CA4hhV76S8= 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=k8LV/yz1; arc=none smtp.client-ip=198.175.65.10 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=1707757493; x=1739293493; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fg8HFd6qXwgrRuKizTmdQy4zN2vPEsdI81OkVtdnatg=; b=k8LV/yz1igpk/NVNBVSN4fCFBVSqRaVN/juIR0QuYKCVW4xKWBJ3CEXD 20DJ8tplemiltLzATsTcCrVfMh9lDwfp75cDsZ+pQpfLG6HqdNSy7AZt5 5vmhKZmqk0dJ0ZV7zCy8xFpRJBLCFqOM6KjKl9PkY338cpB5xhgflRx6X p0bRRu/ex+PjWsc7mD4e9RUeOM6RgfgwVcS7PitOnntIgkhLI5XsS5gpD NRacAxSe5XC4AxJaqBbcmVWPiP6l8ZePq5Tv2ehr4iRpsdwA4v9pETUwh /3O5n6C51QpfD7fsHO6hUxXxWBqfe8A66cKpLMViBnYtYPAKLUOAYeurO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153215" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153215" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116825" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116825" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D5900161; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 07/15] auxdisplay: linedisp: Group line display drivers together Date: Mon, 12 Feb 2024 19:01:40 +0200 Message-ID: <20240212170423.2860895-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790713797077931156 X-GMAIL-MSGID: 1790713797077931156 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 Mon Feb 12 17:01:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 200017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp126782dyb; Mon, 12 Feb 2024 11:35:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEh5xGhPWWoZn+fEjRSo9nVJf6ZECULk6D653NtnLP8/tWgNWQo0xHivdK7J2oTFbi+1ews X-Received: by 2002:a05:622a:1886:b0:42c:3853:c58a with SMTP id v6-20020a05622a188600b0042c3853c58amr803658qtc.25.1707766516455; Mon, 12 Feb 2024 11:35:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707766516; cv=pass; d=google.com; s=arc-20160816; b=SjtoW/25WlDuQVVU0BGWxaN8enSbwGRWr8oOJ40tS/nobGtpbbX7EAZoApwObd1qsX XSy06sBkHn0ErSE3IHOHthBgXbOMaibbonqWT0yKfAxXOvrftOzsVID6usnnL2fQHVH6 vMmoXAs1nZB7AxrqBIIPXBlopmM6QeVUKBxaNhVYelmvOL/frBdTPfMY8NOWG1cR5+Jt Gr9q1BC+gIypIOLSZ05CK+zHZroOeVhk4nofpBm6Bu5ETlf0OXsoR4K7+4c/Px5Fhx70 fgLvW2wb4fDt/yjZvbU8ymmgxVD1NSSppq91496y9sWb6D10NYti/vBraH5ulRj7DQgp ZFag== 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=xEo6Hp5tmN1SnLMI4X4/5Fml+rK//1PSz7d3yg7/34o=; fh=mBnqXB59Zi6c7AQoFofsrb3BEp558+/TzK7j1xdU0Y8=; b=oRBEyehpwQwvyf3waxggau8eY9ZrUB4mHBoj8edkTjGjFCSlrF0ie+qvwpCD804RVC iJqDtnW7Z6qrqLt1fnNCUFxQJsM3ISEkzQQOralfckMC7NU/G3nIQRBV6/FJp7h6SvYl CR7Wv3zBAvR8HGHPwVN+trGAeS3axzjRc5kUbbLT7uN3uPGyS0AcqtBeG54V1XVN8HW3 mpvhIBE+RU02Z7QQhB6eZWx4v9uxTm+gFgf/gsC+w3gZTnw/AGTYrq59olPf6JVXC4FI pYdbmdUuZMZDBuc0vj1nAYFu9A4F4eLjdXufjYum/FhGwDKMCAIye+waLzgciJKWkb+F 726g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="aRm/5VjL"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62046-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62046-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCUtqywx6yie1mHoMXjE9TO/DdIUCXJzWc+bIb43ie2zowfG5HpMX2h70P2kXvAwkfoy8rnpALHgP2KPqOyzJSiCDcq0yA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c21-20020a05622a025500b0042c78a54983si1309829qtx.134.2024.02.12.11.35.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 11:35:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62046-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="aRm/5VjL"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62046-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62046-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 1003F1C224CC for ; Mon, 12 Feb 2024 17:08:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EFE64C61F; Mon, 12 Feb 2024 17:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aRm/5VjL" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 85D793FE36; Mon, 12 Feb 2024 17:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757492; cv=none; b=bXjA7I2DEop05XLOgMZkGKPsOgoYk6ZwPVrXvK0fO918Xj2VDr0VI85WTbe0isLPIyo4jC9l3gQW06C3/faRr1qEbPlqx8A7uBJhbr7jx9KMpPJ6eK4hStcMS85pJtdzGNIh2TRimpAkYlnjnuiQi/fWNEsuUhCGORah6aqXQp8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757492; c=relaxed/simple; bh=uyaajfAMF51QUWBVV1UZLAXvVVvvLfZdmD+gVT959t8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c5m+cOnuGwQ1yQ9RTEIkf8Mo7POsrxWrs/moZYtcIjZDY1YDz/Sx4ddhq+SIo9hw8nt76D9si+86BgdmDYjJiJXBLDMTjzj6jCaXNqD/WXXOBpshYLKgMq5TSM8Psh3W/XNbzeHhtCrM2GE8wdLZD7s7J9EBJkuN0bOWM1EOmAI= 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=aRm/5VjL; arc=none smtp.client-ip=198.175.65.10 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=1707757491; x=1739293491; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uyaajfAMF51QUWBVV1UZLAXvVVvvLfZdmD+gVT959t8=; b=aRm/5VjLcCtVzx2QCZg7973t9CAySRaGwu8WBX3VgY7cNUbdh/MGjtSH U44i7ABXFiDUKhIUwYPmRlA5Xt46ry0fuCFUnpC9dWPN9yZ8akT6H73bf P1r7LQYFuUnKkBuE/KBRKgD+cY19cuRGDQG9MvYsseRBNYsLinHl+VigK AMv57aBF1dxcUt07EBe+KthOG573OuRZAyYJ2PrVhK5ax8pJ/8+KpNxWG E5kGGVObX8yKpPNv+AX74ONkvbS15VM0KkNydh1xqFobzlnFXUH3K4dif T9upXlgjDrLrf5YI93VdgW+/olfEDxSnEkgXI56QDIfAJpitb64nvTZap Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153194" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153194" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116823" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116823" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E585D31D; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 08/15] auxdisplay: linedisp: Provide struct linedisp_ops for future extension Date: Mon, 12 Feb 2024 19:01:41 +0200 Message-ID: <20240212170423.2860895-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790722982584770343 X-GMAIL-MSGID: 1790722982584770343 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 Reviewed-by: Geert Uytterhoeven --- 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 8d0ebdf0f10d..6453a62f653f 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 Mon Feb 12 17:01:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 199936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp51010dyb; Mon, 12 Feb 2024 09:09:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWh4biX9sKM0cxHA2Obp+HcoZP7yoFS+3UpM0+ttCn+b3lokJ5TpcjsER2cJMrMssFfc9XyUMfCyQKFlbxyEWvTNc9BIA== X-Google-Smtp-Source: AGHT+IFB5Qed1VVgtPa7buFN13UFFeBUFVORyrfuOZ38WNz4rBVPBc6x+hcH/uAVv4N5PV1yh+ef X-Received: by 2002:a0c:e346:0:b0:68c:a58b:9f9d with SMTP id a6-20020a0ce346000000b0068ca58b9f9dmr7953359qvm.61.1707757784260; Mon, 12 Feb 2024 09:09:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707757784; cv=pass; d=google.com; s=arc-20160816; b=c+BGxRKeYHJp3Ev+QAmfEMnIPWtAFw9p4XSzGjcvY5BS4aDqMMwqNYsro5mt99LtgD rzKtfIRn3p0B5zsOvobk0H9BRy6G0M+Zqcw4jYSqZGQPb8f0JYSdB52bBqgqELRxC+Pn 134X+5qzQ50OFS4r4XE8yERWSBp3L83Vrmo2klaI9ZWBbNwFFaKcYGuyYS3oAZX9i2hm dlV46krlJyxrwRScbDM5Tb3uOtc+iHTEI+KJS42P9+7fNNCX9rO6WBSX5D5E+5obVpcb +fnkfTaRjSevtwSouJ3w++JJCuQOC/X2MLe3I7aRdYeNCJD0sidH3iDlvInxYKE3s3k1 J9nQ== 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=I/Yr6rBrC3BufaPM3XnCccgsEzJWKJLe4/nR+JB6IuE=; fh=qjYlRGIgq0zAWDLAwp1Vafv32hIMVBNZ/2rZhO1lBRs=; b=01vz3S3a37+J7YVNcEFZo262GxovLgcVnpg9UhjndF/ccjDxHAbpKLUO9UkvKbZvQz g0FnufvdhOpL3yo27hApm4GqH/CcPDy8q0fGVmRv2X39ScgT6NipDXTENgX6zsGGvwDQ /fLBvoWA7UujBynCBV8Ariv9+WeeXQlohLad6G2TWHo3I60m5LaiZJ1qiO/e6esf3HE6 HKmfqjujjm/7mqhlUYpxq6VqLSPOD96vgoqLTZ97u0/yC8HvoSBqOsQYiYU/9Hc0JnA8 CvhM+49ZOj8e7kKzL5suMH753e5H/nF5VSS/Q/itRiws0VZPgW2thyzGAQz7Iq0lWhsD ZsVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ulhx/DSC"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62049-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62049-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWC+st1EwSUiPbI7fU99D7IYZM10+zeyAZxYYkwtzEkC5dsTzXLj14SGag7FeEKh6rzz907UYbqknFwxVrF0NhzQFNV6Q== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g1-20020a0562140ac100b0068cbd9bcd41si789722qvi.97.2024.02.12.09.09.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62049-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="Ulhx/DSC"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62049-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62049-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 DC4D01C226F5 for ; Mon, 12 Feb 2024 17:09:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 663174D9E9; Mon, 12 Feb 2024 17:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ulhx/DSC" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 2D7C144C8B; Mon, 12 Feb 2024 17:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757494; cv=none; b=oXblec86J2s7RDs3gAN9MTbfVoz/7qDQ0J9SqZ7y/BpCdqlzN3cdOC3IKg1CZA0MxjIWX2e5CenUwFzt82h6TGMgEPIU1LU6Mc3+kka653NNrSDuAQ5G4ZjTliGmnnPUyt3bqtsUjsqFKqfMfC2ZPunyWG3jZDXSTcHEp8ZFQO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757494; c=relaxed/simple; bh=Fh1FBaKJwc92BMrBFROUJ6kx0dRqre1zQ6DU0DmV0sM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PTnPdJo4r79Sl6czR0xWcWkCbtXDKOD+ULPCJp1+8FF4qlocTx/t02alf4QvxZDFGv8N9592oLZhr7M0OHBYDdzibK26AkOEukHZPWW2cPIeBTz8cSwiu33xOk4id2ERRof+ua7R0YozGoSWHzV6YDOqmQAisyk4VejJj3c5Ezs= 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=Ulhx/DSC; arc=none smtp.client-ip=198.175.65.10 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=1707757493; x=1739293493; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Fh1FBaKJwc92BMrBFROUJ6kx0dRqre1zQ6DU0DmV0sM=; b=Ulhx/DSC7IviiklRrxduLsSeWQHWUfERlT99nvkfHZjZaktoPK7nbrL+ 1wKLEnTQ6P3PGUEIyVmDPyrcT2k8w15imKdBCPiLUmFhNknoiP2nmqVzl ssORgqN1clpfaKaGxJcyrx5MlhH+861RgYQLFDLlCT8DaktseY6M5soM/ 1fmTxceJ8tk8YLVvaC3hH969vhuieKg7GT/Wy+Oe0GGcf6loKMizeaMCo mvbUDexPCMuidKatHBvnVkIiUahogFLZ/Ak4oF73DmazvBHzt6q+8mgOm NwVfcdBTcPkw/C4BByTVGlRAIWU5e6uPvZeAu6aKoBWZYeo5P43GjKENA A==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153204" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153204" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116824" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116824" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id F3653323; Mon, 12 Feb 2024 19:04:42 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 09/15] auxdisplay: linedisp: Add support for overriding character mapping Date: Mon, 12 Feb 2024 19:01:42 +0200 Message-ID: <20240212170423.2860895-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790713826613426763 X-GMAIL-MSGID: 1790713826613426763 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 Reviewed-by: Geert Uytterhoeven --- 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 6453a62f653f..75852ce6cc8d 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 Mon Feb 12 17:01:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 199971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp80598dyb; Mon, 12 Feb 2024 10:05:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJiO9C3aN+CosezvDEPrTIb4DEdzeeIgFGs7hA7czVv8xCmIl0JuOB8HpK+W1ib15kkL31 X-Received: by 2002:a05:6358:33a5:b0:178:94bc:72f1 with SMTP id i37-20020a05635833a500b0017894bc72f1mr9736201rwd.22.1707761112189; Mon, 12 Feb 2024 10:05:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707761112; cv=pass; d=google.com; s=arc-20160816; b=Wu20uiMHRHPaW+Qhzpppghc7LyGBmvF5lU4M6v0vXWbavRyCJY8wHvAJyJxo68d7hC rKiy/7Fc7inPCHTO5Su58k4LNjPXpe2Y4OAKDULNEzuJTl2ZTRNPzcCAUuBgu+KkhYCc FmEh3N2l/iTy1aZXEUVcixdOJJMArTz5IdcZYWlY3P5ocYFPs5QqivGw97NJAUN0Qd3U UCiIb1UGtX8zUIQwtQG3Vc8Pkmt5+Irb2rx38jWBVYVZrYOYkJmcjzHwQAxTBJE5GPtB /4ThQOSgmToYtr9PFC6l/bVr1ImTphXdAOtpI3JU2tNxxHRXMUYBJjA420OB2x8aG5Ja s4NQ== 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+oX/UcHZISim8TVlLTruFpg/kz2cigX2uvRvTwyPas=; fh=kn2qxq+4A8l9wRZXPmltBlObN8sOd2oFVUvBUeu8Gks=; b=dWc2JDvDc+A9QVULZiPNWz4WhueORDc12FWgXpmHwg4VYU5lJIh8SJfx5U7jSCrOJ1 vcdaUAjooE0KpJg59DvOS9CkVKb2l1O5QKCBBPDH4SpveFtkTgrgX50qlQ10PhVf0FdY OTArdIcYc7x20aHwtVnnFI2B70gox06ZT079VLHpF0R/OEpPu28fS3ROoOtR7F1QMiZM HmJ/oBTNiTtmskTtifEpnl/2uhGmzgw/wkMTQ2EHuXb+0r1Z4IpxAQUuhO3UhnBJnTZv 7+XIvWU6Y0pJGgnz4ojJT9f3+X96lPJz/7exYmUlyWmo6LqHsNA0xAmVb+Pg3ZcW3xde fVlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HLItknqn; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62051-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62051-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCW0JasIxuahiVrFZ5L/E8NQo0vZ3LQ8xTr4OkKkAlG9TlIoQPkmgoFubraonX2D/8PsHv6BIAYV9qVEHoTryLfbPA7OOw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e18-20020ac85992000000b0042bf171ffe8si1067699qte.524.2024.02.12.10.05.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:05:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62051-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=HLItknqn; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62051-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62051-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 1148E1C220D8 for ; Mon, 12 Feb 2024 17:10:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A6934DA1B; Mon, 12 Feb 2024 17:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HLItknqn" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 1EF9F4776F; Mon, 12 Feb 2024 17:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757495; cv=none; b=ULi6FFrOfR9GFSzag23dPOiXfixjRfxqx4+hCQ0Gp7FkdOe2il8Y9poIS5fONSUhKz4z/b0nwIR8w/ZbLNxFim2K/+5oAF6Ei3gtMoGrTwwzlTBDdYQKpcYyCSD3Z+P/QoQpW5NreA+y3GClQjL+PlMR83hwBA5KBL/ytJbw9N4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757495; c=relaxed/simple; bh=bZSIwuNODdqGZ3IZxNzcIUdpLQwmXGNmwkHg29fDE5g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XHFvWHKHNGGAbRNiXhW2ikgGWD2gWighTwDq2L0m8N/ubwAefJ9Wi0webPARCg8evQHoQXz2F0Roz+NAZKFSYyLzNtTuLwSZT33XzyqMjUgqZzvBFHFUWoMm6bN/F1AGsn4fCEyp691wewp/5P8TnKtvbOD72j00qDN0HUDcBW0= 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=HLItknqn; arc=none smtp.client-ip=198.175.65.10 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=1707757494; x=1739293494; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bZSIwuNODdqGZ3IZxNzcIUdpLQwmXGNmwkHg29fDE5g=; b=HLItknqnrSl76axjDpRdgjb6axGJNLnDp0gr3Ewsuv8GeLOLJa+DFP4J KcvvdZ86Bx5BgbgAfmuYlU5scywnY2pSQLqYO9O8UscssSNo4hiF1sKBV yQEGbMszB09Hxv/Mk/DdE6wejlIaKfMfZcENr4Bpw7Pn6a8qJVT0BVLaQ udiylNtgX4wPyfDCjrt5eswjTY6vI4KnHXqftPEgpAULoypmqH802/dSW yD/6YLUTUTaaJVkRIEDyq6eyTugdDPTLhxvTeg/xeO8xD90FGa3YX43KN OTWop5xVGH7qI8ER7OfMm/0ByiX7exZw1v2f0FlC8kGoR1pvtrBXoB73I Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153224" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153224" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116826" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116826" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 09521338; Mon, 12 Feb 2024 19:04:43 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 10/15] auxdisplay: linedisp: Provide a small buffer in the struct linedisp Date: Mon, 12 Feb 2024 19:01:43 +0200 Message-ID: <20240212170423.2860895-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790717316260488767 X-GMAIL-MSGID: 1790717316260488767 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 75852ce6cc8d..d730cd0e1d03 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 Mon Feb 12 17:01: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: 200031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp167500dyb; Mon, 12 Feb 2024 13:05:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXFpFOEFUxZii9XCqJReL3fxPevValNfDxWu5/erzyHG+XRKE3IJhM1xDYU9qULLS3D0egbmNb58BcGVCA3yxgXYGlPJA== X-Google-Smtp-Source: AGHT+IHkey+qK2mCCVn49FX/QONY7Y42nWJB/SdOYxXLn7ae3jF68LT1DTwxTjFTqXqVuFo73N/9 X-Received: by 2002:a17:903:120d:b0:1d9:adc9:2962 with SMTP id l13-20020a170903120d00b001d9adc92962mr737536plh.20.1707771944108; Mon, 12 Feb 2024 13:05:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707771944; cv=pass; d=google.com; s=arc-20160816; b=Kb4ORpoy+/WbytP2Ui7vVaLM3lL4/4DgVImt+ql0tDcbcfrZJU4pLib+8LBPy/P7jq WoJg3sO53k9Fu05RjbodSAqPAQ3d2uRNxChJI8zssL+gF5sQHkuZ4RrxxAles2QePsD3 unOGnhioX2PkwJwSEB/zZRmU6B7kVxu4ZtXBIK7rdWlKM0vjzCplGVPwGaKO4C0THmYr XCw28ZcguYBVTr9VyX9WC163qZ6Vu6LwM91N23mkImMFrYpMs5DkxxXXCsutqsXTZYbF D37CDbhis+JriirPF7l5ifZ/T45j8XvOG3ggtb8WIfp/8wzSIjxtx6RQfybuqzxRHd0g fXaw== 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=cmC+gPTvjTnNDVqEIEBcgbWa587i8gsnevvODFLKqeU=; b=sVOiYNcAsizoomMzAFmFtWhJTv7UkuDuvgBet4c0ZRPizcko+zuU96NNbAMxE1qDs8 t8PT5HxkTOnaFU6wOJ9EJq1Xbf5etBohqc1HOrETaAs2klaVwtt5kBcM0ARy2Zaqclwi Oze+CjINcovTbCKzK8fBoQBzibw6yMHy+bMRfxXRPRBEcuYbg7k2zAPJQTg30SE2KwLA qfC0z3L8nJ2/nKiz0WEkkGdC2BXDaZaHCt1c6gdGgUfVJM0CHsgzafMb1e/U30gEvOn5 wsWQnlPKSMSzttKPLe0UrN/btQX3j52fExmZDf1lphY26kvhWiCvtZODDzZDqSRS1gBj NtIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="OMdePW/9"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62055-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVP6I1N5gCoTaUqtbkI/tDn4O81B2ZzDbdE3jJ6J3B9CThDDy8W6JqX+7T5/m6BZJ8P69hx5H+6nkWhGfMIjJszb4NMAg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id iy6-20020a170903130600b001d9fcd34721si782413plb.119.2024.02.12.13.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:05:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62055-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="OMdePW/9"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62055-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62055-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 B5856B255CD for ; Mon, 12 Feb 2024 17:10:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 746814EB42; Mon, 12 Feb 2024 17:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OMdePW/9" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 086A43DB91; Mon, 12 Feb 2024 17:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757497; cv=none; b=emhMFCdm18isDK02kWGD17nqNPez9GSf0HknpMlNr9WWWJEdu265Dyq5q75xteM7vzP8CkLvIIEV35p4efpa21/hPgZzaoVceim1K98/zhs4GsrUky3sNwGwUMp7Mr3CTuyi010mpgzPmv6gWPAzxv3yPtkFEI0JtAcROjYHToE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757497; c=relaxed/simple; bh=5fFTptxgaNSrb8/J39Uzrc6cETbfYvICnOp+m4GRuCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UCiUmE69CGr+BvVMdbEM1inc+R4bjYGmcawCJy8p9h+W96F5G4Q/6+drba/xaBIcjAozaxsDMHfPDsyKtI1xOiPKEgpse73RRsvd5JgvN0Oxl4BHUXrk7YZFbSY7b9Ee4QFvAApL2+qUiNpx/ib6JdPYME49QJBmlthIvRVb8sI= 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=OMdePW/9; arc=none smtp.client-ip=198.175.65.10 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=1707757496; x=1739293496; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5fFTptxgaNSrb8/J39Uzrc6cETbfYvICnOp+m4GRuCg=; b=OMdePW/9xIUPxFEXT6IiC9GrQziBbcASWrlTI9YCtfoX3rlmZTNJe9px VzaEw9M2VITtJQREcA/wXVG2km9xXeXhUHJmaq5wqmf2Nm6F20ZV1Yz6c 9oqaPtcziIE6nCrU3cslbWhx+eXloZvftAOA7LHwroTZ70Qg2cly7paoK xPsJueaZP65fBzGXY8kwaY/rbGCXk1jLAlC/i2m4OGl6y5fZR5JJwXtrw +UbrZuG+Q30i7KOgzWu1a5/7Gt4EP5YC4je4BhE71dYKc9iALaB6scbXi o42UeBzo9Q8AG9OFKuA6eE7NnNHDKciiB1+6S8At5mwFvJ0ALY5h0/Rlx A==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153235" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153235" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116828" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116828" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1402933F; Mon, 12 Feb 2024 19:04:43 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 11/15] auxdisplay: ht16k33: Move ht16k33_linedisp_ops down Date: Mon, 12 Feb 2024 19:01:44 +0200 Message-ID: <20240212170423.2860895-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790728673998869931 X-GMAIL-MSGID: 1790728673998869931 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 Acked-by: Robin van der Gracht Reviewed-by: Geert Uytterhoeven --- 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 Mon Feb 12 17:01: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: 200012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp124223dyb; Mon, 12 Feb 2024 11:29:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX2+PeGF3RyHlcOppcYAbZVQ/fp6f98ESUP4oeO2WL5sOqiLXXZcbhLc+CvcQBHPX9K3HxPMcr+UgRG6vGZg3EVDlEUKQ== X-Google-Smtp-Source: AGHT+IGllWP0zB7Q8vlsmRav2coOuhAMiNfvcvHh6+rBfmDCVa4Iu9cJ8MhPSI87wxWDdDG/hKwi X-Received: by 2002:a17:902:c382:b0:1d9:e1ab:2778 with SMTP id g2-20020a170902c38200b001d9e1ab2778mr6171849plg.64.1707766175979; Mon, 12 Feb 2024 11:29:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707766175; cv=pass; d=google.com; s=arc-20160816; b=RgusU2wW27TViUKXVz0eShu1gsc3xAddrgsHhiK5J9CiBG24lFlX22ujXReORcuglm DBXoPQe8ylIOl8cZWDUcnLcprsg917rZWNu3Ai3XExgSgtra5by1ssGXCVzhqr79nwE8 J3DdEArEdj/hi/A6y76u2YetQBNVhHaMJS7UVN9349/SGVbTF7G4ow/pIdA1PUH3IbSa BmUj6qTFBzhZONwgPV4DtxfnkHW17KmtnQB+I6ccx0sHDXam4GD80l/7ppZf53h1YyTS LTRg7U6AmTWNf71wqCs88xFwlurX4EwCjuJE0Y6yKudTP9J3Rjq1FNxvaz9d6+XuwL6v C3XA== 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=mUvA/JMdIWZFmYKbkFRHqquw4wiNC9NIP2khEjfSZd8=; b=mV7QW65GQLeMfUvSE8GnQorW2wMizJ0AdaGYwk/39/oeiJupJjcZVnjt6BBsZGFJP9 ckrMpelUKKoLZ9Q/HOj9SfGlCL+KytexFTJU9o7EFYM7nEDnBksgvAbjMIhg52pnA2W7 fiq5anvul3LdFlvZvFbpgMoKpkqjn5an/3aIpMf0RAicypsaZarEZFlm2Pjycuj8K393 dSags4gz2ZGnDo020ArHjCjfpTfz7r3Ie7KppbqM6t3yGhwe9DZlUu8C04ZtrfLAbv4R XAWAWEjIzxr5HujkUwK6qHA0QhzwDMj2beMPMMAbIOaFcjb2gwZ69iu+Kw8uUHa61p0H QZhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GSDl3LmM; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62052-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62052-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCUriytB5Xh5AkoJ1eIh1XyN1IalKQDqKGN1A6orsXGqnLp86LThSPYzQgQ8kMfcFLYKkI31XcbdJCAeHN9fzboo2yUEYg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 17-20020a170902c21100b001d9efc7c6ddsi652096pll.26.2024.02.12.11.29.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 11:29:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62052-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=GSDl3LmM; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62052-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62052-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 D34C0285B16 for ; Mon, 12 Feb 2024 17:10:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0301B4EB28; Mon, 12 Feb 2024 17:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GSDl3LmM" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 4545E47793; Mon, 12 Feb 2024 17:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757496; cv=none; b=Cq+rPK2fEppPyo4gnRIS/KC4RnELlIVDcdNTb+9iQHbfRnAkIIBNYPA7qkTPd4m+3VdzuYiUQXK4Tcbu4In7Pvy9AimLGdkpb6Xth0517WEus5BiK1lVoo8g0MHg3WEkZKQCGbiqqdj8I13vnHBIehhl6XniYN2K8an/JZQ/GzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757496; c=relaxed/simple; bh=xY52GBdbWlUZAfmSG2absg3scItgooHoNN72W48Llrw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bkt5ZYeYzqONf3ZUx1eLIYCYwEvjnGWpXA62BYFuSiGIeBIbRcWZtEgkvlujPDcgOgLU+b3v4YIaLPxB4nn9m+zVB8EQmaoyqrkdCV9Rmvg2MmI2aEiO2D33LPM6exwM1vGSLSujgbM15bd+by+Ys5e6f5j1cX5uSjZaXvGgx1Q= 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=GSDl3LmM; arc=none smtp.client-ip=198.175.65.10 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=1707757495; x=1739293495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xY52GBdbWlUZAfmSG2absg3scItgooHoNN72W48Llrw=; b=GSDl3LmM6+cv41Xp6hUcfqali2NNwI4qJI0SQ6+oo7KSabB+tOvRTH9W IByvWEA+03xShtY6DFt0eWd+HgRleCegiqNsetdMgD4uOpaoA+zlbnph7 JKi0MzGKlbvffBx1M1Xk7Xr0HrsNVf1MBl9C9GBY/3+QXbK7YFqu9jgRQ XuMcFrZCvvI3Z5uHl15XdfqZ9XsJqVGlBoMw4S0vX0IH6idysI4aUW3fd WvSUrvgSLxBHgcKv6YDvhLPDS6+YeYM1HSKGqn1uSUe3Kss3u8/NLXHJr ZYzNGeMwuquH2mK2UUb09VwP6f6sTcX1gxHF7NcN/tiVJNycB7t0/nXxC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153225" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153225" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116827" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116827" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 25799430; Mon, 12 Feb 2024 19:04:43 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 12/15] auxdisplay: ht16k33: Switch to use line display character mapping Date: Mon, 12 Feb 2024 19:01:45 +0200 Message-ID: <20240212170423.2860895-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790722626033088628 X-GMAIL-MSGID: 1790722626033088628 Since line display library supports necessary bits to map the characters (if required), switch this driver to use that. Signed-off-by: Andy Shevchenko Acked-by: Robin van der Gracht Reviewed-by: Geert Uytterhoeven --- 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 Mon Feb 12 17:01: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: 200016 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp126568dyb; Mon, 12 Feb 2024 11:34:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRm3tgBCKb0eq8rlYCv+Ef7kkCzwfdoUt9EmfhgFeePYc7CUt6WrjFlfQLiK/DXtgMrrLe X-Received: by 2002:a17:903:2305:b0:1d9:760d:31c7 with SMTP id d5-20020a170903230500b001d9760d31c7mr8488945plh.29.1707766481926; Mon, 12 Feb 2024 11:34:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707766481; cv=pass; d=google.com; s=arc-20160816; b=dZC5vIkkn0UQ5OY6G/yh3GJIzcpP7hOfB4u/eA2kuZH/xlJzGSJAMCMhw4NzR3+z3j ZTmVBOCBSbkjWEng/Gpykg5S7Y7Eto63xd9qp2CCMGtPyv6ioxy3qTcRJzLTS8sHzZou MtVC3O7BrxWGNKnLe9sRaS2BXuo+bXwOL7MOONgKojnO1zT2HgHgxbWTXAnw9iMR+QI7 uAtSwQ0XRk222zgRqS62fQMGcLzD/4ItOXESyL8gmgVbTjIbd6N18iT1P5a+NCoOkTX5 91Wzqyj/GUlDICisX0c/3wZ3DFjYGX1Q6DV6mVBVxCBLgEnGsN/xC6AtN5VS3bo18F// yYng== 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=iZtF6x6VVmVyK++hFe0WcyBcycnRUUqcP3RGHlxTCso=; b=z47pqOemyXy/1qC7mvUtWOvCQPtsra+WSU8Cf7uKEeWZ8xU8CTXZ5fqkJTu5yKqiSK WZ4+o7u0L3/bFyrpqDwxPMyhiBwAG2Kp+rhtv5Bdc+mD/cMbCmrGCXCIOjcF0c14+3Kg zRZGC8LuOp8IY3kQ9NIOFvmf0wrvr+THoamjpzwsfgzVFjDGFMyVv5ZUMTyKxd7p2P3n 1/jT7WIct3B/tFc53zWQpNdDWgvVUQ293JXplIpHO/+iVjfU87oIJTrwSaq1z2d4rqyx YQ5fT1FyVcsGTX2KrDQJsWUkZi/a3YdjY9AXDug/8oIrvRttd9TwVamKG/eN4djcjwuz 2yJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eiefn8T+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCU6EI/ufO1xA0MeXa7T6V+FoM4Vxwf5n96RU0Y4wbseWSGMCzvq6rrM4oqDMlFyh1MPTOCRf28JZtna+1wGZ2i+wfdTqw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lm16-20020a170903299000b001d8a813bb9asi684757plb.160.2024.02.12.11.34.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 11:34:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62053-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=eiefn8T+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62053-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 F304F28603D for ; Mon, 12 Feb 2024 17:10:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77AB94EB43; Mon, 12 Feb 2024 17:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eiefn8T+" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 7B1C94652F; Mon, 12 Feb 2024 17:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757497; cv=none; b=NM9LT4YNTRxvuWAu4OEzUA/vf2yW6ccpSvEh5SKtuzn3Y6zGpLaYFxrxBhY2D9w/f2RflxYNIIIvxd2tfd7i25hglALZb4+KMBdNh4nKoyI6Gi6WALP8WFWhiJz05Ct8uh0VeVIZBUqUwyIi+rNFvIpyHlI1TA9kHOIldgr4b/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757497; c=relaxed/simple; bh=FH8g0LViq9a54GUNHUMfITSFf708fBC8temf69sHlcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J2pfmXLGIoC7faABCKtVhSAdu967XRpciEJIVTjai+/noiNNcyB/lWnkeuen9Di+V8IxMCyY0rMMo5ByxkPrNBoj5o5CDRFweuMN5BehyddRWdLSWoF4+MY+dx8NcExi+2NUnY5bHUcUZhcLwbG4GSH+T+VjbYATF5XGhD25nEc= 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=eiefn8T+; arc=none smtp.client-ip=198.175.65.10 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=1707757496; x=1739293496; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FH8g0LViq9a54GUNHUMfITSFf708fBC8temf69sHlcE=; b=eiefn8T+QGEnMSt+huirfFCg/ctPTp4hxasmG6N0LbQYFI9zNUCtzc0F yIYr8GWoArzdux6GbPZvRmWv7DCh1fjeeaofg6/h7mBrZ5kfYkYVKgBFC TnL5Bi+pSEv9qpt/27t1QYk8kCdGccELUHmOiPjODj/cKeTvgmYDkeWlB t/Ttfn+F+k6NiN44DRq3irsJuAbznV9onN8JRS7989RLaeRcgw7Xg/AWJ OgunsjGHV/fFQL08UWWdyRjSXSpAEKK+lnC5z2Nto7hDSwS+sRkMzCxq/ +//MlkA3ww6rEFKsAdab1tEu+Rjz/X8xhtMjNkVLmYbCBoh/butwMfrkb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153236" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153236" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116829" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116829" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3100243E; Mon, 12 Feb 2024 19:04:43 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 13/15] auxdisplay: ht16k33: Use buffer from struct linedisp Date: Mon, 12 Feb 2024 19:01:46 +0200 Message-ID: <20240212170423.2860895-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790722946123758409 X-GMAIL-MSGID: 1790722946123758409 struct linedips embedds a small buffer for the string that we may reuse. Update the driver accordingly. Signed-off-by: Andy Shevchenko Acked-by: Robin van der Gracht Reviewed-by: Geert Uytterhoeven --- 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 Mon Feb 12 17:01: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: 200018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp127506dyb; Mon, 12 Feb 2024 11:36:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUTGMyA+B2vPInyYizDises5TFEKm3xJ4mHZChuxfUOgHj2EzcqzXYOhoCm7t8vocjuzePwgbZMiw5Vw839wx2do3mwAg== X-Google-Smtp-Source: AGHT+IG9JzRCsr+/KZ8qKGFTzZodIxzCf0uCZJdL6EV2Y6THX0EADruahCB1MEWqSOG7DQT1ftgB X-Received: by 2002:a17:906:dd0:b0:a3c:2c1:5fea with SMTP id p16-20020a1709060dd000b00a3c02c15feamr5251851eji.75.1707766611823; Mon, 12 Feb 2024 11:36:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707766611; cv=pass; d=google.com; s=arc-20160816; b=vvOqFlZnqOVensMfmvAFbt23g2XoegXbZnSt/ettBlZ0AnQyWqBynUkNg9tIfmLKUh kW/dIkERuC/Z2l1zRLdVdHaGSBE0BRZvDqoZGxoMqqQacJIM5hK427wxHIHSX+J9KygT oN9vFrLfPW5A0SINRnb6/gzUBKSav+Dj/nZI79DBgqXDUGBxrsoiCXYxJT9c18zElAqi +aQwUpqsFoCFKYii49+xecFSoYa/g8QaQFgbCI2idf+29YyvUTfts8z/+IQdNHSSDbNC GoY0R6pA1OEGNqtrssSoosUxhzf6wAHGpWLFWInZreMtAJh2OCUECnttE6jF4I1OHREj nAjw== 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=xD9N3/WCpWIQvO9cPndhh5av/AK0csyGaF3cPs5vP+8=; b=arzoQpVgVGyoWwSOLmN7OJBTlSWa+RfG/o510zuHscrkRyZPXfbDh36Yv+blCNyDkm LGcz+qy9d45KRYUAQOqDUeU66LUa4asFN2zfsDcSBuvaqch8V1p+cwuc638oOGM9m+j1 euGsEm6g7k/bHTMhpTzwu6vrIUV11QlccfQSmwazN3SoVh/o5tVW2NPqypthySMbmV1W S5V4rIBCq2e3hqmAg0Woe2wXomfhZdLmIkt4SYN2cDxHpu8i9RJxUQXDKzWrOWap9RX3 /ZFWjT2HQJLe3ZkPRsZT/mMuUYmyvulAMw/66JcRsWlykvzqoj8ULb/syT4lYAfEYHYL RBmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g8rB7BgP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62056-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62056-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWZ/XR6sMIJHr4hOENzU0xOE9mlYBOtVF3prQUggGhtadC/ljTvISZ6dDROmA6ASxxNHWy0L3azFzNYuOOL2JdKEAN3pQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i15-20020a1709061ccf00b00a3cf224c06fsi69797ejh.284.2024.02.12.11.36.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 11:36:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62056-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=g8rB7BgP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62056-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62056-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 2E0D71F29C4D for ; Mon, 12 Feb 2024 17:10:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD4EE4EB50; Mon, 12 Feb 2024 17:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g8rB7BgP" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 380C34B5CD; Mon, 12 Feb 2024 17:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757497; cv=none; b=i0FqaQ0AgzXbTJcqwchvCeC4tI1XglXk/VAKxAkJ4vleiYWo0qaUU/jagFkMuHDp300C4M3dhF5fwzlJVqnB+1YgV8NRmr2nHS8b5E1gTsr26RqkMCdmmzw2ibEknqy97in5lpOCTuYkXaAe3FUm3WgpCiocXFsD0n7KH3MZtTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757497; c=relaxed/simple; bh=xwQv8uq+9wANm7Kp3tnfC+qRvpRyTa5vpEt37Og3eA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PIX0GcXeT9uDXMJFLZ6r/PWJRukOnAGGOxdnMfFaCWlaqEMyHsJXSwdCPGQT6mmLZp6apuFRVYxUUahWb8J+RgX+k0quVIX8XvbjEH11P7oTGoj44EwobIzXEKN/9iTZ2oa19bh9r+OFib2wffUgKVR+2pgwG8kvsn9EJNbQQ7s= 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=g8rB7BgP; arc=none smtp.client-ip=198.175.65.10 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=1707757497; x=1739293497; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xwQv8uq+9wANm7Kp3tnfC+qRvpRyTa5vpEt37Og3eA0=; b=g8rB7BgPxQR73EpAeiCZdrWaSuvI012tT7YtglB5iG3gDMbO4TZgAwu4 37mi5uUCy5F45WWniZZ+XFR58A84Skr/WCpzKs8jnoV+5kC1LwdWbgOqB 5y4L7Sz9nzOUDdOlbknHW6o1HLnOyN4VjYit0Ix6rglaOgXeoXHQGJnh4 mal66F23svj5MeAgMbrJ4IXDWLIzwxqIku196XGHBfBxaUi79wrELmU3Q mSxkpCREH2Y9ku4o3F59Fm8yTVmrgDKMS9mX24T2adQEaHNhiscQxXRbg HSH05FS8rSXVsgIRg9R6x1t9K012YjeUQUUBR5eSAl69G6qK41OJYfm0C A==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153240" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153240" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116830" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116830" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:47 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 36C4F2E9; Mon, 12 Feb 2024 19:04:43 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 14/15] dt-bindings: auxdisplay: Add Maxim MAX6958/6959 Date: Mon, 12 Feb 2024 19:01:47 +0200 Message-ID: <20240212170423.2860895-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790718236774308954 X-GMAIL-MSGID: 1790723082449936483 Add initial device tree documentation for Maxim MAX6958/6959. Signed-off-by: Andy Shevchenko Reviewed-by: Krzysztof Kozlowski --- .../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 Mon Feb 12 17:01: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: 199938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp51858dyb; Mon, 12 Feb 2024 09:11:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMKNb87Va/g+BkjuBM6nlKjA/3F1LCPAx0icMhC+NAEAGKp49wquP9dBAaZPzlfSOdiTZ1 X-Received: by 2002:a1f:6642:0:b0:4c0:2b39:dc86 with SMTP id a63-20020a1f6642000000b004c02b39dc86mr4456874vkc.5.1707757868897; Mon, 12 Feb 2024 09:11:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707757868; cv=pass; d=google.com; s=arc-20160816; b=fghdI+9ghhLlobc0lb0L2xMNe7Lf4BpIAku/n5/4KWzpABNrXr+xNHyRwsh3EW0c6x ePcQoa3+uWMHRDHhLJ61UfCUAI5oVJ7nOFcYxPgIj/EuXft6tYl5vKfsKRADHhSf+yf8 Xe8kl3po+245NNPV4wXL59nNNTTeZoWcTOsoyi0Omz+UTfYrqGuqCTwa/5xcdCbxW1CO igKx2sUW3J9D3FbSgSlTZ/c83zuBEYVv7Q4OjIlUC+ts98K23F1fX2df0lE8t0auf7Kg XMliGodce+XKDMqK8JVe3ok+tKz6b9f6rKb0CLvmnO9065gRLyHIqLUCvUaoEp4z037d c4ng== 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=Z0fnxvr2Q71pEwa/2Il9Bpz8Jw1ns0Tu+X8epb2GbhE=; b=FCILQUVSlleSziubg9Fwf7r9w5QWRhwflYOndUbrPZjDdPKmJHeDsZzJ5y1GnIV6oe I2uJR6ga08GOwgVYjPoFx1V5oqurMoctyQHyXNefbFwCAbnAitAy0uL2vHrWm0PZftyD zliWs2UTofzP8ClK20kvUJ4ISAETpLaOXc+3AilS3/Yr6D95oSaY8GMRf1qme/Lo7bzE MXBkwuugCi7twzMTKuM91P9/Oz0KuZ3jJI6yLiySousc8pAw+irits+0qw1DXlAsAIYQ IC16vszbdL+rZ0JRZ4VhIUVMYRTsGX/1wWAPUwrLk1c3pSUcEm3IoipPg6fcPVMwo0xP oplA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mP440zFv; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62057-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62057-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCV4Ds4+dUA6O5a1O56Ftwc0aLE13mCq64CkXAj0lc6Y+yRCEc1KNqrMP5lPHr6VXAaDExiI1TYYUwnPaJfzDuOY9bC+sQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fi18-20020a0561224d1200b004bb4f9120d0si803660vkb.117.2024.02.12.09.11.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:11:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62057-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mP440zFv; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-62057-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62057-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 9A49E1C21EE1 for ; Mon, 12 Feb 2024 17:11:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAF9B4F606; Mon, 12 Feb 2024 17:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mP440zFv" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 4ABCD4CB55; Mon, 12 Feb 2024 17:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757499; cv=none; b=HjNE7/BbVJWdEYwiDb2hiV6l/VNgn3BLvCNPyiaDE4tTzN2kDjgQm/vVsbzIoz6hwDdfIk1qtAAW/NAtb8x6c/Zh7yEfderwT/lH95iMI6/Lnb7KZx4Pr2HNgW+12F5iymmzOs7fa7W9M9num+ksVsv5rHBn/vqFA7sTgmleGBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707757499; c=relaxed/simple; bh=v6wTWOcgnBbdVRVq0vTx2zi8kxA67Ld9K3m1TKyiM1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e0heQ/feYW9kg8ye6UedVXsu73+092ISBwrA8IocMr2Qj275NbJI47n7QtTQO0bo0cZuEZC9Y/5VPVOvM28s+1aA8cJJjI05zDezuy45PSvfunJUFEUf0CC7BNSkXArQt0KVGAkbWVp20W0d+vIEiqQhVb9l0Hmjg9MtgUyHMEQ= 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=mP440zFv; arc=none smtp.client-ip=198.175.65.10 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=1707757498; x=1739293498; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v6wTWOcgnBbdVRVq0vTx2zi8kxA67Ld9K3m1TKyiM1Q=; b=mP440zFvoBdSr7zyr+42Ec/IzOKZd6ODy1GFnvG+CYdtyOiPC4XhGE8G zM7WulTm8Olilx4PKWzfwG8+QYB1HlEkpYNMOGiqb/6YT/vako1ju1B1s qJl28oofdVrSEY8ftOMSmEqqQgxpaQDfgX7g+Sd3Bml5TJIjI8BVKTp+C SEEbLG1klni1GYnabCViX/Ya6JFjVU4dKQD2gsTBvJQ9eTPNO0x6/kqz0 dDMX+oCM7/0SFsOTMsd1eXus5UtGBILfFC1w9kq7n/1Ag1OYb0xRv4rlq UjNUUnE21mP6WlP0RLjrMUpB3cKqcBq3ufeKkwwOXcuZlzVS5Lw7pZeUM w==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="19153247" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="19153247" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 09:04:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935116836" X-IronPort-AV: E=Sophos;i="6.06,264,1705392000"; d="scan'208";a="935116836" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 09:04:50 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4740C4E9; Mon, 12 Feb 2024 19:04:43 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Geert Uytterhoeven , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: [PATCH v2 15/15] auxdisplay: Add driver for MAX695x 7-segment LED controllers Date: Mon, 12 Feb 2024 19:01:48 +0200 Message-ID: <20240212170423.2860895-16-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> References: <20240212170423.2860895-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: 1790713915252583111 X-GMAIL-MSGID: 1790713915252583111 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);