Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2732835imn; Tue, 2 Aug 2022 13:55:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4v3lB2k5f58cOy42VT1mAdzdPuqUyH3zxjpT/4OnQm6JHd0w0yhbv9S+gc257aP9T/vhTV X-Received: by 2002:a17:90b:3892:b0:1f2:e0a5:8a56 with SMTP id mu18-20020a17090b389200b001f2e0a58a56mr1355379pjb.9.1659473756420; Tue, 02 Aug 2022 13:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659473756; cv=none; d=google.com; s=arc-20160816; b=yhnmGKmPXc0NL47xFI3Fb02N1LPtdbkgrPMYGPsTjs8iRxJ/r+Ea0rEr9AJxO79cXz 9EIuADepKVVI2cGreiFaIWxXBi4QOQPtD7CZoWTOntidG6ozelI9avSs7No6f3Fl43eZ fOitj3kCgTyR5teb8zBHDU4U5nG+0FffIq+6bKHsAgXxqmtcF9joSefZ6RIgsq3VFzwO HgVeK1wUaZOx26TVkM+PP0KDvlCOUbbx1C3piufIk1UB1BGVr8PBAnwnVUzT/MY1qNuG IcUQadakbzcVXWwIFpUbEQ0IDETtX4AVuYwSVVsM4W1Dh1M3Vht2Uf7Uq9RY+xHvY6zr nMhw== 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 :message-id:subject:cc:to:from:date; bh=UCloMKf0wqHRW0wWu3fUH1EfH11+w7O5H6B9lMBM08Y=; b=p3cz9JwZ9Xh+Ze0lWEKa1sUOMwOLsB6qyil+6hCzfC2AR6VfQ+q0T/A+99VvAYFPys fkLnyWDDMqHIbcn3DhRwPxQSYJiBhjI+OR4r/CjtIM9/Q+l9sWLia2U83jthaR9Do+Ds E8yPqtwVftq54s5bkffZ4f7Dwdlutq9UhuXpd3XlRifxqztMVT1XX1uqi7SQOdBru7TZ /paJCdSHH7elPoW9nxEAalHLzrv8WDaTLH57Ivj5X7wqRdTxEIFa3BmUOJ1+fNFO2dI0 77wOLf/KYIDael5gPP+BF709C2PfxORA+zx8XmMTuhswaOB5yq4P+AQni/hYoY6b0w5H lIIQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a1709027e4a00b0016bf0171143si364175pln.246.2022.08.02.13.55.42; Tue, 02 Aug 2022 13:55:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbiHBToT (ORCPT + 99 others); Tue, 2 Aug 2022 15:44:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbiHBToR (ORCPT ); Tue, 2 Aug 2022 15:44:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6497E45F5E for ; Tue, 2 Aug 2022 12:44:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0AAAF6146B for ; Tue, 2 Aug 2022 19:44:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8634BC433C1; Tue, 2 Aug 2022 19:44:14 +0000 (UTC) Date: Tue, 2 Aug 2022 15:44:12 -0400 From: Steven Rostedt To: LKML Cc: Ingo Molnar , Andrew Morton , Peter Zijlstra , Thomas Gleixner , Masami Hiramatsu , David Laight Subject: [PATCH] tracing: Use alignof__(struct {type b;}) instead of offsetof() Message-ID: <20220802154412.513c50e3@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: "Steven Rostedt (Google)" Simplify: #define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) with #define ALIGN_STRUCTFIELD(type) __alignof__(struct {type b;}) Which works just the same. Link: https://lore.kernel.org/all/a7d202457150472588df0bd3b7334b3f@AcuMS.aculab.com/ Suggested-by: David Laight Signed-off-by: Steven Rostedt (Google) --- include/trace/stages/stage4_event_fields.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/stages/stage4_event_fields.h b/include/trace/stages/stage4_event_fields.h index 80d34f396555..a8fb25f39a99 100644 --- a/include/trace/stages/stage4_event_fields.h +++ b/include/trace/stages/stage4_event_fields.h @@ -2,7 +2,7 @@ /* Stage 4 definitions for creating trace events */ -#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) +#define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;}))) #undef __field_ext #define __field_ext(_type, _item, _filter_type) { \ -- 2.35.1