From patchwork Wed Jul 13 04:47:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9226771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D6BE6086B for ; Wed, 13 Jul 2016 04:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FDBD27C38 for ; Wed, 13 Jul 2016 04:48:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 347ED27D5D; Wed, 13 Jul 2016 04:48:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D36E427C38 for ; Wed, 13 Jul 2016 04:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750911AbcGMEsK (ORCPT ); Wed, 13 Jul 2016 00:48:10 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36320 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbcGMEsJ (ORCPT ); Wed, 13 Jul 2016 00:48:09 -0400 Received: by mail-pf0-f193.google.com with SMTP id i123so2394655pfg.3; Tue, 12 Jul 2016 21:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eRRiQ0H0aRtmDjprUoYYXWOvHC3Gu6OjPVk0rvnFLyY=; b=TOa+t2aRtR1HV54eSYq+/SUAAWRp3uu1ssq5VN+mOIDvRoGo33PBjG/B3uWr25gs+w a3b5ZsANmSJhl7w7w4z5BZVOaiCKEv6BnRE8OOvTVY2ybYipONSRghdLHDMUx7axcvaj VRWG3IP6o+79BHFKZ1CeoUVJ4zQztht9g3Y8NsFzTRYOQZ5Ko/n67lsqAxLDm+vKbOo8 AiE5DCRwGhJAM2+3zHoIdq6vDnTXDODsh6bQ3vys7I4AZozKBnGCoY3Ckjk88o3YWxRL wKeGs6x5MqnrW5FoszhOZ0bwWw3qAS1w6PS84HMslGZod7cx5E1vICx3iG3Vqy3rAtRn jO0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eRRiQ0H0aRtmDjprUoYYXWOvHC3Gu6OjPVk0rvnFLyY=; b=kjOvXB7YCAaXWPddUuSUAqMtBSWDBzaL8gPK8Q49tZSE9t0Y21j1v66xX4DK1a6yea HyvpOJEjusZ0tBXQPczteH+Av9NqdMRwfPhN6Ifz5kYPdx46tgW+bj2nCa95UhnC46S8 BrHeeHHVtdkStgkDb2yjy2I1ktT8qejUUrTQVYONGJy3L8HzTVzmDSBsSoAJYXHBpF9O d6bma627KNLW8nPO7EAaHUOom+j2MX/2rbZazcRZlC7GGryTs3qHwTKUU7e7BGJ/Y7Wm Lon2pE0zv0ug5yaTmxFivxI/zCT2/YUSWvHTePWcK0hD6rgi/aQplKm+NHF55foOO1x1 zPDg== X-Gm-Message-State: ALyK8tKFWZlyKAEVwuURF5QZ35sdGK9mLSElFzR9HPw3/vJAaFrTPJ0AO1WN8LIscDnw9w== X-Received: by 10.98.65.139 with SMTP id g11mr55848pfd.140.1468385243659; Tue, 12 Jul 2016 21:47:23 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id 62sm4042283pfv.26.2016.07.12.21.47.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 21:47:23 -0700 (PDT) From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org, martin.petersen@oracle.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Tom Yan Subject: [RFC 2/3] ata: make lba_{28,48}_ok() use ATA_MAX_SECTORS{,_LBA48} Date: Wed, 13 Jul 2016 12:47:07 +0800 Message-Id: <91a6bb6f4c04eb617a49d9a51f261b661c179de0.1468384890.git.tom.ty89@gmail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <1c10437e3cd9be8556e77462b40ad53be542dfba.1468384890.git.tom.ty89@gmail.com> References: <1c10437e3cd9be8556e77462b40ad53be542dfba.1468384890.git.tom.ty89@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan Signed-off-by: Tom Yan diff --git a/include/linux/ata.h b/include/linux/ata.h index 24f886c..d4bb802 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -1095,13 +1095,13 @@ static inline bool ata_ok(u8 status) static inline bool lba_28_ok(u64 block, u32 n_block) { /* check the ending block number: must be LESS THAN 0x0fffffff */ - return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); + return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= ATA_MAX_SECTORS); } static inline bool lba_48_ok(u64 block, u32 n_block) { /* check the ending block number */ - return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); + return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= ATA_MAX_SECTORS_LBA48); } #define sata_pmp_gscr_vendor(gscr) ((gscr)[SATA_PMP_GSCR_PROD_ID] & 0xffff)