From patchwork Wed Jul 8 09:30:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 235048 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp264909ilg; Wed, 8 Jul 2020 02:30:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysPUntaDYG8pXczwRj7akQki0JeFBONONiCsLL6RadHLe+QegOAgqus910N6aJ7uCGIDZh X-Received: by 2002:a17:906:4f87:: with SMTP id o7mr49972403eju.233.1594200647017; Wed, 08 Jul 2020 02:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594200647; cv=none; d=google.com; s=arc-20160816; b=Jq8XsmqWWram+Cm08Yh/QPbN+ylxZaVPxj04B+BvV60sFdKsMyL4LPcxeHVBkRJOE9 UwT/zdd/h5gb9gjgagd8s8HVW7Cx2NJYeoxhYkPLkYpfsZo3BjqJHI8wOQ79x9ah22rd imeaGEbe1rEqpBZbFe0jqPH5+8Fhs4rTRh1x4BmN8pT7TwR3JfFe3WY7SLtoedJ17lQ/ mkBmQlJcesRK4oJ4ENt98L/zSjtz07+RYewKKLRhtthuLIx3bFfSpA7y3DDU3cXXS5dt mvdXxsQLuv4SHMOpxO+4UKAy8lr3+IJZ6DA06raR96VhliTESygY8Y3VJfVmdNonMSG6 Kkzg== 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=ZG1VUcH+6tOwwV7BnhCzX/gBAhx0Ee8zky2NKNJPpXQ=; b=QA9g6iMHJThFuYLpcKVFSrzDpDfCjIjZj1Dtp2fvUKLspc6Q2RkFboUn58CZQgQDQy LdE7zmuAB5oAcTP7Ys5W5BNFiVaBOavS2SthiubvJiz2aLVHtv/7/11swvR9xJZzCnr1 HzTkFf1xQio2ZNYlltjw02IoUC6D8/j2P1+duoIAbP/ATArVd41Ju0z9otYYIcJZT55m PwWsKcQ6FRcgt1YdvEx70DbVMgulNJ7/WfX29Jp183ceWs/j+6GyOvxAJLgsiFV2I3nT cwwYyA0qJf+PAE98ARpd3E6bF4fwcAeD0VS/Getg+cEyCjlH/td+mXL2wejyTrIMUkum KF3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HJahAXyB; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 dh2si16863975edb.55.2020.07.08.02.30.46; Wed, 08 Jul 2020 02:30:47 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=HJahAXyB; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S1728280AbgGHJal (ORCPT + 6 others); Wed, 8 Jul 2020 05:30:41 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:58106 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbgGHJal (ORCPT ); Wed, 8 Jul 2020 05:30:41 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0689UVkr077802; Wed, 8 Jul 2020 04:30:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594200631; bh=ZG1VUcH+6tOwwV7BnhCzX/gBAhx0Ee8zky2NKNJPpXQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HJahAXyB6Z34ypn9y3jD+pIOIszCEcBFXiT4dOI4C47tZpeT4idB2dcYMSf+Pcm3X rvC3YooTWdS92WgLE11+7NCWgNIDAn5oO29UMV4hunsoPtDFhwn047EPfVZ7w5k+q2 JXirucwvxnKF81rbsau43+Fbp22nnFtogulMNh+M= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0689UVG8021580; Wed, 8 Jul 2020 04:30:31 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 8 Jul 2020 04:30:30 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) 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.1979.3 via Frontend Transport; Wed, 8 Jul 2020 04:30:30 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0689UJEJ098512; Wed, 8 Jul 2020 04:30:27 -0500 From: Kishon Vijay Abraham I To: Tom Joseph , Bjorn Helgaas , Rob Herring , Kishon Vijay Abraham I , Lorenzo Pieralisi , Arnd Bergmann CC: Greg Kroah-Hartman , , , , , Subject: [PATCH v6 02/14] linux/kernel.h: Add PTR_ALIGN_DOWN macro Date: Wed, 8 Jul 2020 15:00:06 +0530 Message-ID: <20200708093018.28474-3-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708093018.28474-1-kishon@ti.com> References: <20200708093018.28474-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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. Acked-by: Rob Herring Signed-off-by: Kishon Vijay Abraham I --- include/linux/kernel.h | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 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 */