From patchwork Sat Feb 3 07:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 19878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp904887dyc; Sat, 3 Feb 2024 00:09:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+pfCu6X2Z0Atei4pMY3LnNT59Sdfl6q4xygyCXeov8rxOp+2qMuQvHuVSAOlPheZN3DFC X-Received: by 2002:a17:902:6b46:b0:1d9:6895:81b6 with SMTP id g6-20020a1709026b4600b001d9689581b6mr4266105plt.16.1706947748351; Sat, 03 Feb 2024 00:09:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706947748; cv=pass; d=google.com; s=arc-20160816; b=ocnaGyIQR8Ezf4y/+OZrCC5+bHJ81GCuiaGZcfRzJQPB9242DhWePGGnEiKy3OvCEO 764WcQkaL5eaYT7xvvVrZKNR4nUdezLNm6Q/cGPPxMZCXmXKL8uyX374HkPiDgL9jijf kDrKoNmBb3LemV6IYYejd9VrG/VSHscewKwUrfj86SoFKvu+mM9+SFhKu7UekUAR9cOf AgjICkbFAjW4aHUumrCqPB0eVRubQfxZR0AOTUBtzIsAmx5Xg/PU0tmFAPw6HTFdpdjK XUfb4CDyBnaZ79rWRUCVNYD+HvkZCCSmmwhNWA50+OLJdgaeQOS6+q70/RPVpO8/59Zo idfw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=OCUMJ2d4ncLXSH5gQLn7aWRhS08Qda8fr6S/AVc12+o=; fh=bjFh88oXDJ1AZKeBFkix9n77sxXuBGA6JWlQfcVVqvI=; b=gDw9n6Ml5qe6yjQm/kxp1Fdn+aInkn5TKxfZgbHZVOZOdY6ZAF1qmPFC7Qm32duF73 wraSLzd1JptfmZwvYfsl0QJYt0lHl3cJ3gfTNGN5M4fP6J0f+WB7sr4vUc9+VmqCFbNC /y+aepfM4Boiv2yXYXMzxXsEUNy24AYemwRD8cSLyluqNXP5W4mKuHxiK3NmsxJadDST HS5ISBo+m1UsyP89XnFHyZNfkRtD16X9/6CdHQ4Ax63emQkTgDhXj3loxxMsykYbGz4Y XRIBao3wPjmqQjb5lvp3ZCoO4d+yfv0ukA8hf6ZHt0a/gg8N/ThQZ+8no/kOGIWW23JH pZNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ruPngsdF; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-50965-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50965-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr X-Forwarded-Encrypted: i=1; AJvYcCW+tFWycroOHKqeaezAn1cwm/xSThLvkF3bQGLL36iZPG11y3Y7+0GjyCpx/SnJuXiKqkncbxFxr7qyGb66OmZ2M/wUvg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u15-20020a170903124f00b001d983de4bfcsi1371276plh.221.2024.02.03.00.09.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 00:09:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50965-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=@wanadoo.fr header.s=t20230301 header.b=ruPngsdF; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-50965-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50965-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr 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 BBCF8B297A6 for ; Sat, 3 Feb 2024 07:52:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 347D84F5EC; Sat, 3 Feb 2024 07:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="ruPngsdF" Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4484018637; Sat, 3 Feb 2024 07:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706946745; cv=none; b=GuXUBDUadgK7hxHYoFe/RIWZvcVYYBXQMwdAO03snXpc93oMmTGGeieLNKYQwMiIn8Nh4hnqwI0rUtdVoNhKlD0bIiPVnK/Y1sAn2Q6hdw8I4/WAC4PAhjqC+ofPYIqPuZaBip0qi2R/AvKGz5h7IG7tBto4AMZzf7gV6Oc5+X4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706946745; c=relaxed/simple; bh=F6ITBLQvJo2ID4GvkMI70FgRvtOxvEz87EYOHEv1yuo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J6XXdUUcKVLoAQfO4/K03Ugbuhu/4dBCZ02u/AbCRr/Dn5Hs7MILdy4G5HzYVnK/zWcaRkRb2Eb98AJgu3oMmS/+rsmpaQU8KdtBw9RirveA5oAldO0aiOAi123B66Z2qqfeHBV0FTAf42b7vThMdPaMa0vI/dt1/7cpFPN5iNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=ruPngsdF; arc=none smtp.client-ip=80.12.242.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id WAnwrvC6Ki8tRWAnwrIHzh; Sat, 03 Feb 2024 08:51:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1706946674; bh=OCUMJ2d4ncLXSH5gQLn7aWRhS08Qda8fr6S/AVc12+o=; h=From:To:Cc:Subject:Date; b=ruPngsdFv92lgXoOcl+hbe1MSS1gg2pZWHHh4E022SYll+kGz+kDeGvHu8ZgaliGW OwncwnjK9aWpAyBkpPltlnTwOfylTCUzC7p10RyXMOYjRt37z6Sok/kIfY4JqWArGi z8Q/mBojZI+GLjXbVvYzmcUR5DquA6/YjBcP/zcl6nDfIvZfzliJxn0s/PVMcWdcdH 8Y4Rv0j8LU11pS6gAlr5IspqztuYDlup7oafaQrhqDoel5BPrjSylKkYeQSwyy8DZb 5zZU4TkBuYiqXsHl6wSgpsy7rdEBMB4u/As9z70ClA2qnlCxPSBTEFZILFLPzR8nLX tmUPSpv7FMHVQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 03 Feb 2024 08:51:14 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: krzysztof.kozlowski@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2 0/2] nfc: hci: Save a few bytes of memory when registering a 'nfc_llc' engine Date: Sat, 3 Feb 2024 08:51:02 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 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: 1789863458205311506 X-GMAIL-MSGID: 1789864441795293574 nfc_llc_register() calls pass a string literal as the 'name' parameter. So kstrdup_const() can be used instead of kfree() to avoid a memory allocation in such cases. v2: Add a new helper function, nfc_llc_del_engine(), to reduce code duplication. This is needed to address Jakub Kicinski's comment about nfc_llc_exit() that was not updated in v1. v1: https://lore.kernel.org/all/6d2b8c390907dcac2e4dc6e71f1b2db2ef8abef1.1705744530.git.christophe.jaillet@wanadoo.fr/ Christophe JAILLET (2): nfc: hci: Introduce nfc_llc_del_engine() to reduce code duplication nfc: hci: Save a few bytes of memory when registering a 'nfc_llc' engine net/nfc/hci/llc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)