Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp22036336ybl; Mon, 6 Jan 2020 16:44:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwNIFcZV+hoxyYKT+21a+6yr941KrY0JZwOU7PhqSeLcstRqaOc71rYVfylY0HBjdsaxGI+ X-Received: by 2002:a05:6830:22c6:: with SMTP id q6mr9137843otc.244.1578357844573; Mon, 06 Jan 2020 16:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578357844; cv=none; d=google.com; s=arc-20160816; b=nYGuSD9Zcq5Kxx194Jv70v6ntp6ED7K0Zu9MVGRQijwzdfJ28eakFGl+Ttyp/kL35y EwI6m0KsRwfks4wCYpg3haE/4tROGmiu9RFzBoMHIDaX2rM1XytUhbGlISps/OPU2MQx iG/3J//XhGdzXtd0jJ4eEf9NPWc3hdaw7LYHXxt0UPTWhK1CCUpU6UhORx1uFOcofcIK v/MqLzqAB/x7lnyxgWGCY1uNR0mI6YsCcN6URiCwHj60+XRyHfZdfHOY87cx+DaDZ186 kk2L8eohAguU8nPC3LWbvoSQjd8GF67hH7V+LxuTmd3HpzFbC1ySoBO8vi697kbTy4y1 hpuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2BlBBdlGTuLlXDSlD9fRaOwY7xbSqzXQ+9DZfMQk/VE=; b=YEcffsDzC7J5lGj2+Gh7y54IUWW1brNkJ+Z9hNLQVzCU0donDJfnLGDdfJpj46Zbp1 HE89NTbi4yYwh0L0SKoJNcaB/Hdd5kgBW0PBOeF+90MPIrnvMjRrEzet1XVuY8KUwSzH xDPx7U1iKBFKTk9v1dCijE+agH40sw01L6AcKvgZpqkrL//uN41ZFg94K5qeEvh8lpGB 6AvMLnNghx6OORowkV+ETZfOgrJFfran4ttwdoaQ3O2X9nNN8241y2I8PDDUrR8EzqdP 9Gy7abvYDTQGzJ4+HllPrpwRqdKW9wd9fziTHzFPRf1gx37vPZXS4aiwwdrrqfITPCrM N3lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bK0FbfvP; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si205811otg.325.2020.01.06.16.43.34; Mon, 06 Jan 2020 16:44:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bK0FbfvP; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbgAGAnb (ORCPT + 99 others); Mon, 6 Jan 2020 19:43:31 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:46222 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727233AbgAGAnb (ORCPT ); Mon, 6 Jan 2020 19:43:31 -0500 Received: by mail-vk1-f196.google.com with SMTP id u6so12983910vkn.13 for ; Mon, 06 Jan 2020 16:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2BlBBdlGTuLlXDSlD9fRaOwY7xbSqzXQ+9DZfMQk/VE=; b=bK0FbfvPnuViNAOc9L966TjIfcadOxZIquOI0AhDIPyRawCwORXbislHd33sdNaLEQ kP8pRCH4TZp7OBO1taA+pdjiZSPHfWwv4tq6qmu5wl3WODX+clubBjmCyctsgLICOdk6 99+EyJv43P+rvxrN7Ba70UiCJQ/BFBr6yy6+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2BlBBdlGTuLlXDSlD9fRaOwY7xbSqzXQ+9DZfMQk/VE=; b=MGNaJ9wgRVAmHV4lP+c4G1JNY15WayUi7sSlS+ccdvJjR4c/i9irubow25PGux3Wt1 sKDly/kRVgGa2yxf2Phos9+ZtbXa2bsv4oKiuSsC9mM4fXYD55y7buoa4ANfKVHARnaT faY6AcMiQMcZAd1/qoiYALZKkKDZyplYjRgRpCamsyCVZyEAU9G2JbnAVzMbwBQ42RUk qAyjTyW3fG9lEh8Xlz5lQwiCzGrkm+dTF5PL87j3UxSqGB5X5mRLA27i2D6ZGbFFCwHW wDy1R5J7vCIkmV+BKQ26DkeQFe95FLLlLvYW/oGn3ihUugNaSJdYj1RzhdqWpVPEx6mF X1NA== X-Gm-Message-State: APjAAAWEYc2c9rEvIBudHK9eqBxnXKMaAgWAzeHkqVbKnVkh3oe3KxkI BZUwRYPAVA5dWK37IucNEC/fFAvyyok= X-Received: by 2002:a1f:3fcd:: with SMTP id m196mr61566983vka.28.1578357810037; Mon, 06 Jan 2020 16:43:30 -0800 (PST) Received: from alain.c.googlers.com.com (239.145.196.35.bc.googleusercontent.com. [35.196.145.239]) by smtp.gmail.com with ESMTPSA id k1sm6305244ual.2.2020.01.06.16.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 16:43:29 -0800 (PST) From: Alain Michaud To: BlueZ Cc: Marcel Holtmann , Alain Michaud Subject: [PATCH v5 1/2] Adding a bt_dev_warn_ratelimited macro. Date: Tue, 7 Jan 2020 00:43:16 +0000 Message-Id: <20200107004317.152792-1-alainm@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The macro will be used to display rate limited warning messages in the log. Signed-off-by: Alain Michaud --- include/net/bluetooth/bluetooth.h | 4 ++++ net/bluetooth/lib.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index fabee6db0abb..bd2675266859 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -129,6 +129,8 @@ void bt_warn(const char *fmt, ...); __printf(1, 2) void bt_err(const char *fmt, ...); __printf(1, 2) +void bt_warn_ratelimited(const char *fmt, ...); +__printf(1, 2) void bt_err_ratelimited(const char *fmt, ...); #define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) @@ -147,6 +149,8 @@ void bt_err_ratelimited(const char *fmt, ...); #define bt_dev_dbg(hdev, fmt, ...) \ BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__) +#define bt_dev_warn_ratelimited(hdev, fmt, ...) \ + bt_warn_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__) #define bt_dev_err_ratelimited(hdev, fmt, ...) \ BT_ERR_RATELIMITED("%s: " fmt, (hdev)->name, ##__VA_ARGS__) diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index 63e65d9b4b24..755bc7c12e2d 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c @@ -167,6 +167,22 @@ void bt_warn(const char *format, ...) } EXPORT_SYMBOL(bt_warn); +void bt_warn_ratelimited(const char *format, ...) +{ + struct va_format vaf; + va_list args; + + va_start(args, format); + + vaf.fmt = format; + vaf.va = &args; + + pr_warn_ratelimited("%pV", &vaf); + + va_end(args); +} +EXPORT_SYMBOL(bt_warn_ratelimited); + void bt_err(const char *format, ...) { struct va_format vaf; -- 2.24.1.735.g03f4e72817-goog