From patchwork Mon Jan 19 21:48:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1670 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859402; bh=/jFSrLNMti+wH0yMiPOwpRb9Boo35q7QnuVOOzLkpZA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=MMBleu+vVA21DT5TWU1HLOnJ3fxZybA4AgmmXccsvvaWJRwL3nnjjp+BaVOdEdAVA ELvwWWIQUk3O2ezPf0UyfXIA5uO54bQ/VR7cc864csvjsc8vCPFXcTWBeb2e54NUXZ pv+fk6WQlL/RQae2WczvfrTc0mOuzgGoPK+vGyb/rb9TQ3PtSzzEQdgAfM/gt3KQsA op9xJSdKfpVbPTXmM6nfI4bsp13I9wgrwhDCm9IXug3cjGJHlVMoOIYpsm67Qj/9k5 11mRH8X2T42JWTjDwRqLz2hcrVQpA+Ot5DVPgaegcLfiwaECiseXxSJ0w1W52pgYDK 3AQ6TMdEXjE8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3286E6951A for ; Mon, 19 Jan 2026 14:50:02 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 6gCkoi3uIeJB for ; Mon, 19 Jan 2026 14:50:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859402; bh=/jFSrLNMti+wH0yMiPOwpRb9Boo35q7QnuVOOzLkpZA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=MMBleu+vVA21DT5TWU1HLOnJ3fxZybA4AgmmXccsvvaWJRwL3nnjjp+BaVOdEdAVA ELvwWWIQUk3O2ezPf0UyfXIA5uO54bQ/VR7cc864csvjsc8vCPFXcTWBeb2e54NUXZ pv+fk6WQlL/RQae2WczvfrTc0mOuzgGoPK+vGyb/rb9TQ3PtSzzEQdgAfM/gt3KQsA op9xJSdKfpVbPTXmM6nfI4bsp13I9wgrwhDCm9IXug3cjGJHlVMoOIYpsm67Qj/9k5 11mRH8X2T42JWTjDwRqLz2hcrVQpA+Ot5DVPgaegcLfiwaECiseXxSJ0w1W52pgYDK 3AQ6TMdEXjE8w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1DCE169520 for ; Mon, 19 Jan 2026 14:50:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859400; bh=nzGVI+zkgQB1Pq06/VpjHN+xtRIq92KuJa0JbER2R+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aMwjLaO9EAQBJRdY63xdtjCfbMtGRGTpHhU015ondVLhC6OBF9nzeGCuHi7wxeP8D ue3bTLBEf1IkGPNicMSnRz7f68kI42N0OsoGUfea7YcND2UtoWxYiWRHWJDqvQ34DV iW51Lvd1NRHJUdhlnuleuHrv11g7wqloAOQhVaoHQlyoHa0d7lFJeagdP6GI9hz2VF FVoI4ia9DMFug8H1YWLZzgbus7xyOk/f3LbpKxC6vZKP16oI5lDjRnc5ypmOPWyguF VZVUskX3GfWhc1bYiuuJcv4MQred2aynFAanOkPiuvKJknlQOaR6JnK5Tyrlro0v1O j7gSd/At+VRQw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1F15669520; Mon, 19 Jan 2026 14:50:00 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id Eznc3nyQH4-x; Mon, 19 Jan 2026 14:50:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859395; bh=HSyMtaxT3IuwUcJTvIiwViMGJ+VjlrhB0A5p6NmTXOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6oDCnY12wSlfFs0+LPB/qTNeydWPUBdCHFFGZf2oeBxYQvXILfb6busRQ6J6rcD3 CmEL9b0bkl+rQYDsttmZQ6ojmxBSjWegUlTM65Fqlk9YU4WTpjdd18+QjNyW169o1k qZxkgClsk89vk4W5Om1WaWNwuxJO1NwmrrWh7bjNMbvLWajM88zixKud0eCbIMT3Ea NWKTJ31tV8m+ndaqkw98fUHuVAdhs7sCxZWJ4FXpFa0ntAVnzHXStaaVblFz3csmY2 7yC2DfCH9X9JBt1HKqOl8nSG4PYTErALRk5dZ9zukTOu0evtP9FG7SxmPhn+ce8ElZ aM11Oo6OTYU1Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2DDDE6951A; Mon, 19 Jan 2026 14:49:55 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 19 Jan 2026 14:48:38 -0700 Message-ID: <20260119214846.3087611-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260119214846.3087611-1-sjg@u-boot.org> References: <20260119214846.3087611-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BLE645ISXGTYOLMEDWRAOEIE3EGR6HFJ X-Message-ID-Hash: BLE645ISXGTYOLMEDWRAOEIE3EGR6HFJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/16] ext4l: Move KMEM_CACHE macro to linux/slab.h List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Move the KMEM_CACHE() convenience macro to include/linux/slab.h where it belongs with other kmem_cache functions. This macro creates a named cache for a specific structure type. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 3 +-- include/linux/slab.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b50004bca55..484bd70222f 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -297,8 +297,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* Memory allocation - use linux/slab.h which is already available */ #include -/* KMEM_CACHE macro - use kmem_cache_create */ -#define KMEM_CACHE(s, flags) kmem_cache_create(#s, sizeof(struct s), 0, flags, NULL) +/* KMEM_CACHE macro is in linux/slab.h */ /* * RB tree operations - use real rbtree implementation from lib/rbtree.c diff --git a/include/linux/slab.h b/include/linux/slab.h index fb809063593..15d561f0527 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -117,6 +117,16 @@ struct kmem_cache { struct kmem_cache *get_mem(int element_sz); #define kmem_cache_create(a, sz, c, d, e) ({ (void)(a); (void)(e); get_mem(sz); }) + +/** + * KMEM_CACHE - shorthand for creating a named kmem_cache + * @s: struct type name + * @flags: cache creation flags + * + * Creates a cache for objects of type struct @s with the specified flags. + */ +#define KMEM_CACHE(s, flags) kmem_cache_create(#s, sizeof(struct s), 0, flags, NULL) + void *kmem_cache_alloc(struct kmem_cache *obj, gfp_t flag); static inline void *kmem_cache_zalloc(struct kmem_cache *obj, gfp_t flags)