Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp954336imn; Tue, 26 Jul 2022 14:05:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tacp/zoAJaAqoPHBb6dqScAny7OhG1iUm+oHEIC8m87PiJ09qJfMN3a4RuDyUXHsWoLYY3 X-Received: by 2002:a17:907:6d1d:b0:72b:6d8a:ca64 with SMTP id sa29-20020a1709076d1d00b0072b6d8aca64mr15465411ejc.371.1658869559316; Tue, 26 Jul 2022 14:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658869559; cv=none; d=google.com; s=arc-20160816; b=UvGsW5QAGOWAbQSxfXbLq7FLjN3SgthA7QClm8PCjrEzDYpRCbawPi0qicFdDSZq/C fVMioVm02qAG6M1poipUyEULT/zkxT1qthqmjGGF/EoC6AnhzUCVt4cH4PSKocuK5o8Q 3gEPRugpLpPgd1BtHjXzM5EQrNHeiGcAsOKYJUqyu7Q5LJm5l6ZOdHSKGoFcWp4Oe+Ni aw7zHaYsVIqtV8dheJMMMBfZhQXF2ugCb/me9bPU+4Lk4brAqZ8e+dgXm3mbSTPnJTen xtXdYc+kl24NnULKgFQpMNRf88CwdQGWMe3s+DuFf3Ew6lGCiiq/TbO0x7QzFKk4zi40 j3Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W6W3RCGbQm1ftNxYyveQiUbovGJZ//OaxbWEapVu2yM=; b=U7FV5YKNyUh/8O6qyBKjR9EnTrZFAYU8qa7w5FRqG+1qDT/FnexeNRPqfZyg5B8xIP 4U3irkISKH+i80Unl5Q4OlpZ7fq1kin6QHIpbVacpA5zqsvU9+4YGooVlbzjo0o/fvoS K/YAngpHVYX7oVUwrmaxZpejfwneRiYZELJGzRQoy/KeJyWHnobLgjIqSOj/9d3tlsSI t4CEu7qSbn1BCFLLc8NAOjGE2KfTp+Cb67+CbI5bAK+fcs3/BOz72YHbfD46phYkRtTi Gvn4eqH8Yh/dHXgSj4wppjAiPuj+CrSdSFbJjNxhx2scgWkbGcWwohaa210TMdWgcVal R3wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=VlEPTxUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp15-20020a170906c14f00b0072b45412527si18077976ejc.843.2022.07.26.14.05.12; Tue, 26 Jul 2022 14:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=VlEPTxUO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232198AbiGZVDa (ORCPT + 99 others); Tue, 26 Jul 2022 17:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233029AbiGZVD2 (ORCPT ); Tue, 26 Jul 2022 17:03:28 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC0A3246F for ; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id oy13so28291385ejb.1 for ; Tue, 26 Jul 2022 14:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W6W3RCGbQm1ftNxYyveQiUbovGJZ//OaxbWEapVu2yM=; b=VlEPTxUOtupcAqH7Q4BD8fcqrFDVV/Op6UWKf2AerNjOnj1M9GeBbUX05bPqPMGwgh 4Pasf+xKWSfvxxbCCdonxcXzlMEv2B6VPJhQzQMJkqLHxeb/35XOoyive9dcYQbiIaXE qoMYB3pGw8UaVztIg2OSZ7ofDzMG7VDJjkEIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W6W3RCGbQm1ftNxYyveQiUbovGJZ//OaxbWEapVu2yM=; b=jatnDwbeUlUCyyPj0MQnxipqtr5V9CDxHlIbOpENMg3x5ccFLXk9etjFIcwA055b4+ ZxkfhLtrVVqvaCjGBiQ8ZWk2+Rz2x/uBnccNJ6uAvM2Zx1EjweKQ0YvQE1oUlc8bWlp7 CIysOxm7PCjBC/OBgIf/MBkoHi3EzMPmp+yFOJiuX0rYqpw/+CHburHvUjeeE4qnuRp8 KsTaGInyvQ6wOoF1RZhHV3ea1pF+L7ufmCuVQivAsqjMK02VFS9PPlCfZApHrE9bmN2H IGy4fdfXi46QEQDrIgq8ZzVGyQobkldoFxg6UG8QWBwc07v+nSu4ieBS0/0QW+iE5P4y GFpg== X-Gm-Message-State: AJIora/r9wqxyT9gtKeYtpPbViIJ+Rs29JW0IpMtnFax4pAODPoJFaSB H/qzWQ5WJuJcSbTcGTLaiOqo++9tpu85Og== X-Received: by 2002:a17:907:2722:b0:72b:735a:d3b4 with SMTP id d2-20020a170907272200b0072b735ad3b4mr15381214ejl.363.1658869404930; Tue, 26 Jul 2022 14:03:24 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id y19-20020aa7d513000000b0043a7293a03dsm9092849edq.7.2022.07.26.14.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 14:03:24 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-can@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , michael@amarulasolutions.com, Amarula patchwork , Jeroen Hofstee , Vincent Mailhol , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfgang Grandegger , netdev@vger.kernel.org Subject: [RFC PATCH v3 1/9] can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names Date: Tue, 26 Jul 2022 23:02:09 +0200 Message-Id: <20220726210217.3368497-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> References: <20220726210217.3368497-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Mailhol The driver uses the string "slcan" to populate tty_ldisc_ops::name. KBUILD_MODNAME also evaluates to "slcan". Use KBUILD_MODNAME to get rid on the hardcoded string names. Similarly, the pr_info() and pr_err() hardcoded the "slcan" prefix. Define pr_fmt so that the "slcan" prefix gets automatically added. CC: Dario Binacchi Signed-off-by: Vincent Mailhol Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/net/can/slcan/slcan-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index dfd1baba4130..2c9d9fc19ea9 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -35,6 +35,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include @@ -863,7 +865,7 @@ static struct slcan *slc_alloc(void) if (!dev) return NULL; - snprintf(dev->name, sizeof(dev->name), "slcan%d", i); + snprintf(dev->name, sizeof(dev->name), KBUILD_MODNAME "%d", i); dev->netdev_ops = &slc_netdev_ops; dev->base_addr = i; slcan_set_ethtool_ops(dev); @@ -936,7 +938,7 @@ static int slcan_open(struct tty_struct *tty) rtnl_unlock(); err = register_candev(sl->dev); if (err) { - pr_err("slcan: can't register candev\n"); + pr_err("can't register candev\n"); goto err_free_chan; } } else { @@ -1027,7 +1029,7 @@ static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd, static struct tty_ldisc_ops slc_ldisc = { .owner = THIS_MODULE, .num = N_SLCAN, - .name = "slcan", + .name = KBUILD_MODNAME, .open = slcan_open, .close = slcan_close, .hangup = slcan_hangup, @@ -1043,8 +1045,8 @@ static int __init slcan_init(void) if (maxdev < 4) maxdev = 4; /* Sanity */ - pr_info("slcan: serial line CAN interface driver\n"); - pr_info("slcan: %d dynamic interface channels.\n", maxdev); + pr_info("serial line CAN interface driver\n"); + pr_info("%d dynamic interface channels.\n", maxdev); slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL); if (!slcan_devs) @@ -1053,7 +1055,7 @@ static int __init slcan_init(void) /* Fill in our line protocol discipline, and register it */ status = tty_register_ldisc(&slc_ldisc); if (status) { - pr_err("slcan: can't register line discipline\n"); + pr_err("can't register line discipline\n"); kfree(slcan_devs); } return status; -- 2.32.0