From nobody Thu Oct 2 10:38:59 2025 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F00A41FF7B3 for ; Thu, 18 Sep 2025 12:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758197621; cv=none; b=r+qDZjvBf8N+0AEsmCPzDD1TzV0Gj8g8FB0IVWNyQsbx8s+FQSWOfYXPOPTo6OsK5SPJv08DWJPOY9k5p5qTLSBUr045TN7V5noWcvKCWJfM4ypzEEdJZnGTKSd1AuRZllg0lAMIsgE4x5sSM++0O4yVNYlYRpZzaEhBv8L7V3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758197621; c=relaxed/simple; bh=1G4flghObBmoHal5iOBv5mtrAxWP6etmx/TF7zvVBlA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b40fLb1+6Rjo55w+0uIH7lNErhleZgAxpJ4MHk+1t1AJIcRarccY8nXA4X8gU1hJcvB/5pee3Dw38a7j5eGH8qij21x4zve9+tt8yUXhfABhopP/lU1PAHYe4afrdYx8D1mFR65sGelX2HmDg1AUFFgjrHQUgXuiiCfvayGlbwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N3vo/06k; arc=none smtp.client-ip=209.85.219.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N3vo/06k" Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-7900952fb89so8014816d6.3 for ; Thu, 18 Sep 2025 05:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758197619; x=1758802419; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aFlo8CznMFg2dIpKqYtA20b3rwjoQ1cupxnccT2OfmM=; b=N3vo/06kD3YuXJPTNZ89KzlGWvTfhdHHqVxp/z1fejwnimr6xsbB6KxnP9D1IhaYEx zCk7VmAYlGwBTwQwYXPMKnc935/m05CjQpvvFkcy0eK0hOR5lbCdY2WVLV37/RPkCaKD pu3USSSHBGpQs58rZmMPwhp1TpnYpUYffvnJlw+L0Fjke31cdiZzVTMQmHgSnlWZ6WFc WHmfIjCXk+Mm0A0FssSkGs3WfUuX3k3AVmMyRlKw2vpG5REGKeDkgHAMhbYS/1NsHrQe F7RrXp/M8Ao89eO8osspgFnlqktx931oR35gMOe2wKWOTGrNk233b2MODY9MNwTqaSbT JcOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758197619; x=1758802419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aFlo8CznMFg2dIpKqYtA20b3rwjoQ1cupxnccT2OfmM=; b=RCrnnHIvS8B5ZIG9vTuagfSeO4H3HBAZQ+f9BM1Z2SZkAcViB6KU10MSd7TmOKqplV /rLiRWnRMEt85zsqp5/A8kHt/A3NF0uLwGbfMpplRwl53HTjS6R+JsF5nw8eoc2nZGZo HFQkuHLXkGY3qblKypmjuA4q65zHwPTNw5Fge6PX866eeFmDeiC+AWsY3KM34gK9BNdo az8iI++Ocd5dWu4B+mTb89j5lp1c3WKiZuXPNUrqMjIQ9BpgFjCRO40Aqrylyjtca/Tm NxIHjMATAMOIbZHnRiwiWpM/gy7l1mdeOzlL09+TYI1RWeiN0AmOi89Q4JbQjRMFxUH5 pVSA== X-Gm-Message-State: AOJu0Ywu6TZnewzfFyu7vewAbhdiZff69ZaRSMeXRRRQ0j5SX+QDw6ZW 3VcVnpBAUJIXx+xg9TfOPaw+9ukUvWuAKUumuWp82DOnSQ94BJPkzkkNrzJMcQ== X-Gm-Gg: ASbGnct7zDMTTwWipE59cUFOpi7LUml5SYWwkAvV8KxzXUXJf2cTm5Rdzgbd0aaEOZC t5uTf/2vt/2Y7FmRO+EYzxm1fzKGz69+/TwgNEq7KLz6+Ym4gNrBDjIVFzCqFSvWMBFzJWi0foi P/r35VZhLIsOgbDjEDGZ2JMgkOhpxPP9PtoCMCwJ9XQ79UFgMl1TzT5wYvAjaGqeczUFJVqwxkr 34B5WWyrIkRpXfikACJr2ffzP2WgFUOPasGFty8HH42FuBPlxHjzXdG5M51SG0BY3pW0syEg46K Rp/wi0JYVUVlzO/h8/sMq0VHnkecsuqiBT6SW/ACcqxHqIczCJDC5Ek4wYaT6C1Hsapc2CmdSwB X+pYlqezx2Ke9bR/FTjDf8iXvpm2dH9QRT1Qf5gsyEGLjtRTIs5O+7JZc9YYgW+t9it3h1G8Mb0 Jtcw7GxgwtKy4= X-Google-Smtp-Source: AGHT+IGP8lFwftwqPiVPMY0ySIs/nKEoP6hDoTdih/xQqIv12ahvrTg2o8QpS8/nsSa988Tlt6wEIQ== X-Received: by 2002:a05:6214:250d:b0:736:514b:b8fc with SMTP id 6a1803df08f44-78ecccff412mr77522746d6.19.1758197618671; Thu, 18 Sep 2025 05:13:38 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-79355725df5sm12016436d6.64.2025.09.18.05.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Sep 2025 05:13:38 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] auxdisplay: linedisp: encapsulate container_of usage within to_linedisp Date: Thu, 18 Sep 2025 08:13:12 -0400 Message-ID: <20250918121321.116248-3-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918121321.116248-1-jefflessard3@gmail.com> References: <20250918121321.116248-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Replace direct container_of() calls with a to_linedisp() helper function throughout the line-display auxdisplay library module. This abstraction prepares for upcoming dual-mode support where linedisp context retrieval will need to handle both dedicated child devices and attached parent auxdisplay devices. No functional changes in this patch. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- drivers/auxdisplay/line-display.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-di= splay.c index 8590a4cd21e0..e44341b1ea22 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -31,6 +31,11 @@ =20 #define DEFAULT_SCROLL_RATE (HZ / 2) =20 +static struct linedisp *to_linedisp(struct device *dev) +{ + return container_of(dev, struct linedisp, dev); +} + /** * linedisp_scroll() - scroll the display by a character * @t: really a pointer to the private data structure @@ -133,7 +138,7 @@ static int linedisp_display(struct linedisp *linedisp, = const char *msg, static ssize_t message_show(struct device *dev, struct device_attribute *a= ttr, char *buf) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); =20 return sysfs_emit(buf, "%s\n", linedisp->message); } @@ -152,7 +157,7 @@ static ssize_t message_show(struct device *dev, struct = device_attribute *attr, static ssize_t message_store(struct device *dev, struct device_attribute *= attr, const char *buf, size_t count) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); int err; =20 err =3D linedisp_display(linedisp, buf, count); @@ -164,7 +169,7 @@ static DEVICE_ATTR_RW(message); static ssize_t scroll_step_ms_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); =20 return sysfs_emit(buf, "%u\n", jiffies_to_msecs(linedisp->scroll_rate)); } @@ -173,7 +178,7 @@ static ssize_t scroll_step_ms_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); unsigned int ms; int err; =20 @@ -195,7 +200,7 @@ static DEVICE_ATTR_RW(scroll_step_ms); =20 static ssize_t map_seg_show(struct device *dev, struct device_attribute *a= ttr, char *buf) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); struct linedisp_map *map =3D linedisp->map; =20 memcpy(buf, &map->map, map->size); @@ -205,7 +210,7 @@ static ssize_t map_seg_show(struct device *dev, struct = device_attribute *attr, c static ssize_t map_seg_store(struct device *dev, struct device_attribute *= attr, const char *buf, size_t count) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); struct linedisp_map *map =3D linedisp->map; =20 if (count !=3D map->size) @@ -232,7 +237,7 @@ static struct attribute *linedisp_attrs[] =3D { static umode_t linedisp_attr_is_visible(struct kobject *kobj, struct attri= bute *attr, int n) { struct device *dev =3D kobj_to_dev(kobj); - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); struct linedisp_map *map =3D linedisp->map; umode_t mode =3D attr->mode; =20 @@ -263,7 +268,7 @@ static DEFINE_IDA(linedisp_id); =20 static void linedisp_release(struct device *dev) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); =20 kfree(linedisp->map); kfree(linedisp->message); --=20 2.43.0