From patchwork Wed Feb 28 20:41:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13575964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BF7DC54E55 for ; Wed, 28 Feb 2024 20:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5oKAk2GjTgn+XYJ0Hucnp09FazUW9uUhY1SZwy2JOnw=; b=yb3sCtC2hodUcR 8TshYtxTrC0U4qg2A+r4qWwtijItCazxD2PuIfgtFqYbpsG0bvE/YqxHQlkGfr/AIYLGlt+8MyCeF rvDHTm+2QkNsDyoJXZu/AFkODzi2CmdUoW/ivrjEiMER/+ZXc9TEBg+Iea3TBoYfyA5RokTikX5r6 tLFZnWD8mUSEvQva2nvoSUmIb4fFbywttLmtFc/fT7CTM5T5LWqgQzFzb3oeRLrHo4SDJR8+OZry5 VTkLBHeWiImwxPx66DbthyHTpCr3FtdviXTmj1SXpvohasTbYA1WwR+QsC00HghZrmPHVNu8YiYcm lkZ4YARAFpecctyXtEWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfQsE-0000000AtBm-1iJh; Wed, 28 Feb 2024 20:49:54 +0000 Received: from mgamail.intel.com ([192.198.163.17]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfQs2-0000000At6v-4AWW for linux-arm-kernel@lists.infradead.org; Wed, 28 Feb 2024 20:49:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709153383; x=1740689383; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/llCeBOq/akHF/gxzRufHNlRAWfKFNHHOOSUCKXMrCA=; b=Yy+9ktBub7H9UB97z/si8zDPdEyRJI0F0i0rRAFzGlydGfZgwE0fGFUu E+CTWa8F+nau8TmN62GzMOaHS7URoocKjZLakcgqrJ8CQyTKWHACe4kPa X3XrcwySaSLYtHmvnlZlxSgECi7pBBN9xkCUP32qZr52XNEhDViGQShqd rblf5awyCBuG/Jq68jCX3Kf2TGVNUgmYXZsQz7tg0O+s/AGtmjMivimlB 3LAkao6EK7ZE4cIF0A+iKHfLo8m0AB+sWu9/Nb93EUN6u6QL5iVrvN3Cf /heHq3klOVdHO6/b0/N15WczDFrX0lwmE146/Eod8/8djv7SWlnelljII A==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="3428694" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="3428694" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 12:49:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="937034657" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="937034657" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 28 Feb 2024 12:49:35 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 01E211C5; Wed, 28 Feb 2024 22:49:33 +0200 (EET) From: Andy Shevchenko To: Vinod Koul , Linus Walleij , Jonathan Cameron , Andy Shevchenko , Mark Brown , Kees Cook , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-spi@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Gustavo A. R. Silva" Subject: [PATCH v4 0/8] iio: core: New macros and making use of them Date: Wed, 28 Feb 2024 22:41:30 +0200 Message-ID: <20240228204919.3680786-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240228_124943_073588_24BEE032 X-CRM114-Status: GOOD ( 10.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Added new macros to overflow.h and reuse it in IIO. For the sake of examples a few more places were updated (requested by Kees). In case maintainers are okay, tags will be appreciated. v4: - dropped applied patches - refactored macros and code to make them simpler (Jonathan) - moved (renamed) macros to overflow.h v3: https://lore.kernel.org/r/20230724110204.46285-1-andriy.shevchenko@linux.intel.com - dropped applied patches - use switch-case for the supported clocks (Jonathan) - redone opaque_struct_size() to be simpler (Uwe) - dropped wrong hunk for krealloc_array() conversion (Jonathan) - dropped initcall move (Jonathan) v2: - sprintf() --> sysfs_emit() (Nuno) - added tag (Nuno) Andy Shevchenko (8): overflow: Use POD in check_shl_overflow() overflow: Add struct_size_with_data() and struct_data_pointer() helpers iio: core: NULLify private pointer when there is no private data iio: core: Calculate alloc_size only once in iio_device_alloc() iio: core: Use new helpers from overflow.h in iio_device_alloc() spi: Use new helpers from overflow.h in __spi_alloc_controller() net-device: Use new helpers from overflow.h in netdevice APIs dmaengine: ste_dma40: Use new helpers from overflow.h drivers/dma/ste_dma40.c | 12 ++++++------ drivers/iio/industrialio-core.c | 16 +++++++++------- drivers/spi/spi.c | 6 +++--- include/linux/netdevice.h | 3 ++- include/linux/overflow.h | 29 +++++++++++++++++++++++++++-- net/core/dev.c | 10 +++++----- 6 files changed, 52 insertions(+), 24 deletions(-)