Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5409534ybi; Tue, 4 Jun 2019 06:19:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMvnUSDkVdZsb7TGmsRbSnL/nVkzaG+sN0GdZ2E79VrS72zHMUzZZ8Pg4YC073OrgL1XMl X-Received: by 2002:a17:90a:ac14:: with SMTP id o20mr9281744pjq.114.1559654382761; Tue, 04 Jun 2019 06:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559654382; cv=none; d=google.com; s=arc-20160816; b=uBFMuxdS2rJMOxNMWK2OBHEsb2bl1Os81/djPJy//j5r1tnBD58NE7KHg0NP6rb4O/ 4I7H6Af9+Ex8o2jxWOgZ9+nPb3f5kvDPZ2u3qa7+U0DmA6I2L8lOEF1awHrGd05fA7Lt 7UsbZ7zi21l/NkKgD3MEpE2nohWolYt/kOa+kB3heX8y2Hcu3okrMsHOpMbuaaVXNw+z 8cVlgjNwg2Ch9fLSiRv8UdxGOEjnE//PypY9sZAw9k6BotrLF6dxQqW0C/tRB9z6JpJR 5yhZWYqVdanJH4/JKp56DR+amhFtDTfXT1Bxn8tFwiemoSDyn1C01jzcQ4/aYGT4AOpl +HlA== 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=gskYCXt69auxdl0gJm5PmVmDCrGNb92GxmcQN4v//vI=; b=thxez7+MklBr9SVuDOismxJr2uRh7gioTMhGzflrDOWwnZjlzCPHG/eU2k8qRROsPw WiBkLdD1UqhcK/2gs7c2OPUrEpYFJadBQFmjCphLHSLF35LU0mwyNcUYKeUXq3AAmkSD qQ5yNcV6/gKGudQKFl5TguXbIPq6l84BYUB+2VnNCrUlbaCVtLvpanfkldJPs9kz267Y QqyMxo/N0ZpMMX8p0c14iN3Es+RarclPjgtWYCTfxiGtkwr1G6PeKibJSnUALUdePY4H MAp8s+QbGv2rm5OWIjKQTbm5UBfp4az25L2PsVWjWwr18tijLLZ5olTLQLjMmiSzpptV P+Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FZrwJCy0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id w13si22764406pge.212.2019.06.04.06.19.24; Tue, 04 Jun 2019 06:19:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@ti.com header.s=ti-com-17Q1 header.b=FZrwJCy0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727539AbfFDNRc (ORCPT + 99 others); Tue, 4 Jun 2019 09:17:32 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:54854 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727480AbfFDNRb (ORCPT ); Tue, 4 Jun 2019 09:17:31 -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 x54DHD1u027960; Tue, 4 Jun 2019 08:17:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559654233; bh=gskYCXt69auxdl0gJm5PmVmDCrGNb92GxmcQN4v//vI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FZrwJCy0oF0940yJ1Ges+n6/f/6gfkwi/N2rjMaSwcFAhzwrUyrlOK/UTy3CHL+b4 FfHYPO+7aXQbd9He0w5ngaEoaMUIH8tBK354E0FwyLdaZ3IDNCJllHtlFmT+4JIFrf SaqAqv6a8M87X221Mal/XQziW2sjRBOIqRkwxTXs= 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 x54DHDRb042475 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2019 08:17:13 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) 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.1713.5; Tue, 4 Jun 2019 08:17:12 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 4 Jun 2019 08:17:12 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54DGdGL098972; Tue, 4 Jun 2019 08:17:07 -0500 From: Kishon Vijay Abraham I To: Tom Joseph , Bjorn Helgaas , Rob Herring , Mark Rutland , Lorenzo Pieralisi , Arnd Bergmann , Gustavo Pimentel CC: Greg Kroah-Hartman , Frank Rowand , Jingoo Han , , , , , , , Kishon Vijay Abraham I Subject: [RFC PATCH 05/30] linux/kernel.h: Add PTR_ALIGN_DOWN macro Date: Tue, 4 Jun 2019 18:44:51 +0530 Message-ID: <20190604131516.13596-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190604131516.13596-1-kishon@ti.com> References: <20190604131516.13596-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 74b1ee9027f5..f5be987f1f95 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