From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759885Ab3BZI5z (ORCPT ); Tue, 26 Feb 2013 03:57:55 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:4996 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1759842Ab3BZI5x convert rfc822-to-8bit (ORCPT ); Tue, 26 Feb 2013 03:57:53 -0500 X-IronPort-AV: E=Sophos;i="4.84,740,1355068800"; d="scan'208";a="6771528" Message-ID: <512C789D.1090404@cn.fujitsu.com> Date: Tue, 26 Feb 2013 16:55:57 +0800 From: Zhang Yanfei User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.8) Gecko/20121012 Thunderbird/10.0.8 MIME-Version: 1.0 To: Andrew Morton CC: Joe Perches , "Eric W. Biederman" , Simon Horman , "kexec@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/2] kexec: Use min_t to simplify logic References: <512C44E4.70907@cn.fujitsu.com> <512C4881.90409@cn.fujitsu.com> <1361867881.2023.16.camel@joe-AO722> <512C76FE.4070109@cn.fujitsu.com> <20130226005328.e2d31a97.akpm@linux-foundation.org> In-Reply-To: <20130226005328.e2d31a97.akpm@linux-foundation.org> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/02/26 16:56:48, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/02/26 16:56:48 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 于 2013年02月26日 16:53, Andrew Morton 写道: > On Tue, 26 Feb 2013 16:49:02 +0800 Zhang Yanfei wrote: > >>>> diff --git a/kernel/kexec.c b/kernel/kexec.c >>> [] >>>> @@ -822,13 +822,9 @@ static int kimage_load_normal_segment(struct kimage *image, >>> [] >>>> + mchunk = min_t(size_t, mbytes, >>>> + (size_t)(PAGE_SIZE - (maddr & ~PAGE_MASK))); >>> >>> #define min_t(type, x, y) ({ \ >>> type __min1 = (x); \ >>> type __min2 = (y); \ >>> __min1 < __min2 ? __min1: __min2; }) >>> >>> >>> >> >> Hmm, from the definition, the cast is redundant. >> >> Maybe I misunderstood what Andrew meant in the mail related to v2: >> >> "The types of PAGE_SIZE and PAGE_MASK are vague - iirc they once had >> different types on different architectures, so some form of casting is >> unavoidable here." >> >> Andrew, could you please explain the casting you meant above? > > I mean that a cast (or min_t, which is a cast) will be needed. > The code you have here casts the same thing two times, which isn't > necessary. > > Thanks. Should I resend the patch again? After removing this redundant cast, it is the same with v2. Zhang