Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp547109ybz; Fri, 17 Apr 2020 06:00:27 -0700 (PDT) X-Google-Smtp-Source: APiQypIy6cZOJ5megPfxAhISqjF6SlxAZuZDC+6pQRvYmli71kbTUVBVEDvc/Pb2ydmQAGZyKltf X-Received: by 2002:a05:6402:7d6:: with SMTP id u22mr2816098edy.149.1587128426913; Fri, 17 Apr 2020 06:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587128426; cv=none; d=google.com; s=arc-20160816; b=xclvOBqIVm15kiVn0ki0QzMV1NJKFZARtA3SX3i9QrVFwjGrdImF7zt2UFfuN8J2oG NpXT029tzYWe6+tTYFKDqU3nqzlK8LpEOSH7QL1loxDXHVoLJbnCETkDs3z+xjKjop3R x/CMr0/6TCJ5C9NsnjDsnQ6AhMz4RKW8HZJRjB50hh5egQjxd5ZQSReVRSzw8iVP7YDZ BjSgJhz5EqB2MtA3yxboqNVS5YF1dccGx7tOGCqro7+ohCfL8U70eKHuIbJY14e3V7SD suJ24AD2schx5iNyuBEBQDHwOFQpabJTFUW1HxVItMg0lP4jpL5fhEYGjVU2optQjjOh qbfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ANKUGmxjcIwlV3rIaZN/J5tOLrnX04VnB9EtUZpb2tU=; b=wmyzSVftxDaegY/IQhDcelVD5T4lQs8Y8Fq8W5BAIZJR8TBGLJsEo62JJ24eB8KfLI Q9ZlBthHc/GnHiBKaL0CBKbPan4i6oVQfbtkyek9Rl9A86F39dJQYzezUN0fRCK36LXl el0L6AbnaQz49IVIj9QqvxxEw9ic4M1vM5jp0KSifL1ssAp3s2HnWs+6TkYyaTibY0f5 jofv7YTZCY4cL676I2hlVtYgR6MwW+CWuewcA9pyHs6h6hIirVZgyY2LqHFRr6GvAwdW D9q0HE9WVSSIlaE0X9uCLNs8yArlRPJOiaX4mS3ZVds9BJUZ3LPjqIbBeFCK50j2Q5+U ihLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=vJyLydBb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si13218765edq.121.2020.04.17.06.00.03; Fri, 17 Apr 2020 06:00:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=vJyLydBb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730019AbgDQM6V (ORCPT + 99 others); Fri, 17 Apr 2020 08:58:21 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:47174 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729828AbgDQM6V (ORCPT ); Fri, 17 Apr 2020 08:58:21 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 03HCw5Bn013732; Fri, 17 Apr 2020 07:58:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1587128285; bh=ANKUGmxjcIwlV3rIaZN/J5tOLrnX04VnB9EtUZpb2tU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vJyLydBbBLghDDKzGmRc4DlmcG68d0v5qQX4ps6ix7y5Wj/WoI7eSRdDPlnDeVPSD 5dwvxqb/ScdadpKBLv9PbtSwTHDnzKQ0RnR+hA2V1WBCLz2H4k31lh9Z79DphA/PdB SdvuHmSScJ3mDfRYb/dp6dSedpamZCqRY4UiyHxw= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 03HCw5kN056755 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Apr 2020 07:58:05 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 17 Apr 2020 07:58:05 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Fri, 17 Apr 2020 07:58:05 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 03HCvsD7031089; Fri, 17 Apr 2020 07:58:02 -0500 From: Kishon Vijay Abraham I To: Tom Joseph , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Andrew Murray CC: Arnd Bergmann , Greg Kroah-Hartman , , , , Subject: [PATCH v3 02/14] linux/kernel.h: Add PTR_ALIGN_DOWN macro Date: Fri, 17 Apr 2020 18:27:41 +0530 Message-ID: <20200417125753.13021-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200417125753.13021-1-kishon@ti.com> References: <20200417125753.13021-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a macro for aligning down a pointer. This is useful to get an aligned register address when a device allows only word access and doesn't allow half word or byte access. Signed-off-by: Kishon Vijay Abraham I --- include/linux/kernel.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 9b7a8d74a9d6..c3b361b5be54 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -34,6 +34,7 @@ #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) +#define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p), (a))) #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) /* generic data direction definitions */ -- 2.17.1