From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D02DC10F29 for ; Tue, 17 Mar 2020 10:50:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CD80220658 for ; Tue, 17 Mar 2020 10:50:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bzZs2WNX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD80220658 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7DBC26B0007; Tue, 17 Mar 2020 06:50:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78D686B0008; Tue, 17 Mar 2020 06:50:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C9006B000A; Tue, 17 Mar 2020 06:50:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id 550B36B0007 for ; Tue, 17 Mar 2020 06:50:08 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0CF20824556B for ; Tue, 17 Mar 2020 10:50:08 +0000 (UTC) X-FDA: 76604534496.15.drain77_1e3d8a868043c X-HE-Tag: drain77_1e3d8a868043c X-Filterd-Recvd-Size: 4793 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Mar 2020 10:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584442207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9+aMWLUapVvNMXY/iDTt59UcxSOTA2pdOne/agbEdHc=; b=bzZs2WNXkmdol9Zg85xx7XBPe4V/y4RizvYPFdsEzestsn9W3CrRbGSE9d4e3BGrLJFBVE /bh9ZW8JVyLfe+JLltm9vqHOR+c2nGLZAhAFaOH++8SsaOKr4gQUlu82dZWJhmzzj3KD/V ShBYkZICHYL09oENfNIPWkQDj8JxeT8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-tM93PLi1MDS_IoxpDVxnVw-1; Tue, 17 Mar 2020 06:50:05 -0400 X-MC-Unique: tM93PLi1MDS_IoxpDVxnVw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2AD59107ACC9; Tue, 17 Mar 2020 10:50:03 +0000 (UTC) Received: from t480s.redhat.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5DBF73865; Tue, 17 Mar 2020 10:49:57 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, David Hildenbrand , Wei Yang , Michal Hocko , Greg Kroah-Hartman , Andrew Morton , Michal Hocko , Oscar Salvador , "Rafael J. Wysocki" , Baoquan He Subject: [PATCH v2 2/8] drivers/base/memory: map MMOP_OFFLINE to 0 Date: Tue, 17 Mar 2020 11:49:36 +0100 Message-Id: <20200317104942.11178-3-david@redhat.com> In-Reply-To: <20200317104942.11178-1-david@redhat.com> References: <20200317104942.11178-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Historically, we used the value -1. Just treat 0 as the special case now. Clarify a comment (which was wrong, when we come via device_online() the first time, the online_type would have been 0 / MEM_ONLINE). The default is now always MMOP_OFFLINE. This removes the last user of the manual "-1", which didn't use the enum value. This is a preparation to use the online_type as an array index. Reviewed-by: Wei Yang Acked-by: Michal Hocko Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 11 ++++------- include/linux/memory_hotplug.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 8c5ce42c0fc3..e7e77cafef80 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -211,17 +211,14 @@ static int memory_subsys_online(struct device *dev) return 0; =20 /* - * If we are called from state_store(), online_type will be - * set >=3D 0 Otherwise we were called from the device online - * attribute and need to set the online_type. + * When called via device_online() without configuring the online_type, + * we want to default to MMOP_ONLINE. */ - if (mem->online_type < 0) + if (mem->online_type =3D=3D MMOP_OFFLINE) mem->online_type =3D MMOP_ONLINE; =20 ret =3D memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); - - /* clear online_type */ - mem->online_type =3D -1; + mem->online_type =3D MMOP_OFFLINE; =20 return ret; } diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplu= g.h index 261dbf010d5d..c2e06ed5e0e9 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -48,7 +48,7 @@ enum { /* Types for control the zone type of onlined and offlined memory */ enum { /* Offline the memory. */ - MMOP_OFFLINE =3D -1, + MMOP_OFFLINE =3D 0, /* Online the memory. Zone depends, see default_zone_for_pfn(). */ MMOP_ONLINE, /* Online the memory to ZONE_NORMAL. */ --=20 2.24.1