Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp418439imn; Wed, 3 Aug 2022 09:20:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ZqqXAcAohxWamPdrJFOk3fuXyMZ1JV02h/qNdfq5+l5CMI2qypn1Xpyz5vqiQUusPwsyu X-Received: by 2002:a17:907:1dee:b0:730:b7d9:626 with SMTP id og46-20020a1709071dee00b00730b7d90626mr2195048ejc.135.1659543653363; Wed, 03 Aug 2022 09:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659543653; cv=none; d=google.com; s=arc-20160816; b=Sje47FQ8NSOuX319NfFgaXyuMryt68fZJCDhyZIM4rXlCfjaVjpO1TteFFXddXOh1l Ar0OO78HJxe1UCejlgwsSnDwQFYh2d2fBOL6vk4cvqDepx5VIBzr/r6mac1EiejtQbO/ jjo0+x/xaZ5Vr9kcwlTJUPhQjvxTE0I9Sn0Opgfcj6Bn3Hjl0sHA3RXa2r+QyjsMVbWO mPj+TLnycfbhrnBqt0WUwEtkTYMmfEhiz8eYGSm+lA9MLZEO6qsJSx/mmXjq+Y5DAg/L T3FHwFizjmc7rmy28Jx0yPocNmSn5fu8wiexyFgaXwdg3uPm1rA6NnWCZf0RT5h/nC0U /LSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UKO1/rEOvQmtEJGktos0f5GmdjWPfN/2qxHIP8XAMis=; b=ubl0j0UpUlS+RJF/4DVaboAiYOMBxmkI8VRlBVmF5GC5iDLkRqSbl9HZkQ3snNYx1O f+hP2ODCK+X4BuLJOPdhnBGNnVBXRUTnNIqExOMKNx21KkRgmdSxIPatYA33gCMIsXdw ZtVWwN1TlDurt3aPKp3d9Bi6fFPHUimXAQtbm2cNyNrOJE2pd7ONyoVgsBdXbL0lT4gc mAmV/y8+Ipc6zPBgta3J1SK42Ayi9aOh0MSzg4vbnPUxrEEaHlKzLjkaqQhYl4JTDVL9 geF+1CvXwHmha4UgwvKG8wRg1VT81JcbqLF5GN0GNsUn7k2X2eHoCLAcbYKYbQBYn16v RUQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i6Jc7cQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he41-20020a1709073da900b0073065ea79bfsi10412641ejc.528.2022.08.03.09.20.27; Wed, 03 Aug 2022 09:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i6Jc7cQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237699AbiHCPaa (ORCPT + 99 others); Wed, 3 Aug 2022 11:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236050AbiHCPa1 (ORCPT ); Wed, 3 Aug 2022 11:30:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D95835FC5 for ; Wed, 3 Aug 2022 08:30:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9143AB822D7 for ; Wed, 3 Aug 2022 15:30:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3780C433C1; Wed, 3 Aug 2022 15:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659540624; bh=WyiGNSvjUwTkeWatQt6mvRLOsng36yiXnSh2JSzLRrg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i6Jc7cQbD2cp2V52UmyKRjQOZyQPrH26eeYGyQKiRCcM50RyTyUIdw5lXyOut5mXV Py9O9dinpZU5uHS/nRKPHG3Cit8NnTzIQzuikohG4AoCqyWK+2OSQPmNtLAP9PtrC5 IkRvV45yNk27fFbVzY2jsAYraB87SQOZcCPLK/SY= Date: Wed, 3 Aug 2022 17:30:21 +0200 From: Greg KH To: bchalios@amazon.es Cc: linux-kernel@vger.kernel.org, tytso@mit.edu, Jason@zx2c4.com, dwmw@amazon.co.uk, graf@amazon.de, xmarcalx@amazon.co.uk Subject: Re: [PATCH 2/2] virt: vmgenid: add support for generation counter Message-ID: References: <20220803152127.48281-1-bchalios@amazon.es> <20220803152127.48281-3-bchalios@amazon.es> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220803152127.48281-3-bchalios@amazon.es> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 03, 2022 at 05:21:27PM +0200, bchalios@amazon.es wrote: > +static const struct file_operations fops = { > + .owner = THIS_MODULE, > + .open = vmgenid_open, > + .read = vmgenid_read, > + .mmap = vmgenid_mmap, > + .llseek = noop_llseek, Where is this new user/kernel api being documented? See, put it in the code please, no one knows to look in a random file in Documentation/ > +}; > + > +static struct miscdevice vmgenid_misc = { > + .minor = MISC_DYNAMIC_MINOR, > + .name = "vmgenid", > + .fops = &fops, > }; > > static int parse_vmgenid_address(struct acpi_device *device, acpi_string object_name, > @@ -57,7 +124,7 @@ static int vmgenid_add(struct acpi_device *device) > phys_addr_t phys_addr; > int ret; > > - state = devm_kmalloc(&device->dev, sizeof(*state), GFP_KERNEL); > + state = devm_kzalloc(&device->dev, sizeof(*state), GFP_KERNEL); > if (!state) > return -ENOMEM; > > @@ -74,6 +141,27 @@ static int vmgenid_add(struct acpi_device *device) > > device->driver_data = state; > > + /* Backwards compatibility. If CTRA is not there we just don't expose > + * the char device > + */ > + ret = parse_vmgenid_address(device, "CTRA", &state->gen_cntr_addr); > + if (ret) > + return 0; > + > + state->next_counter = devm_memremap(&device->dev, state->gen_cntr_addr, > + sizeof(u32), MEMREMAP_WB); > + if (IS_ERR(state->next_counter)) > + return 0; > + > + memcpy(&state->misc, &vmgenid_misc, sizeof(state->misc)); > + ret = misc_register(&state->misc); > + if (ret) { > + devm_memunmap(&device->dev, state->next_counter); > + return 0; Why are you not returning an error? Why is this ok? And why call devm_memunmap() directly? That kind of defeats the purpose of using devm_memremap(), right? thanks, greg k-h