Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2663079pxb; Sat, 28 Aug 2021 23:21:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym6P9woEcEnqxtWtCGbO0YEvJVnkb8az33j4l+VlMzZRwPgO7S/KIV2UrUx7jB3sWEUx8/ X-Received: by 2002:a05:6e02:1d1a:: with SMTP id i26mr12000056ila.96.1630218069511; Sat, 28 Aug 2021 23:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630218069; cv=none; d=google.com; s=arc-20160816; b=KPKpKTKGhCiWtctdoYMB3iJQk9zvEPLFUTXdfvyYV2dYxkm/HArLzRQPIlmxKQ/qcm s7vdv2eete48JDI4I2+kHqT6PMzDiQOMZrYBlnhn4hreh0NzWWPMs1GiQR+pQOss//Fw wHQnDgUUuvFHWHQqDPmDj2B4lvXB+y7m342mPAon6GEInAUmEhsLtp9c3IuT/jJZj++4 m5v+zpQLVXHyvgYRoOMK4V9Ilm/eHbgSfKxN+ySCNlvfz4S8+Sea+ZbWixUmfqWr0rx7 8KFxuvNC1I0qKSqo3731bU2hVFrGKVbbUugpe5hP43b2GcdPuupWg2b1wHgnSPrwSC3J 9xKw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RJjs2b9JI5hWDnP+6Dy4uhx2+L/pHu9I5HCrw4RSt4Q=; b=SmyveEA7C3iUkK8f6mk8l2FOKcSbsSZ2zFJDZlEeylHr71jOVejSnBOs0l2u/iKc02 5nZdxAwNncNZcH/aRcr6AauZm8UaqfrdCmDLSseWUfgTMZm6xY0idlZVanY8RAP7QZgo f7wIv2847cgLBKTROCQ7h/CBgqR6Tz5ZqDQNcj50q1fliEmU49RHc2vmv8zHw8m42w0N n/iIBhEz0UkJFgtW/nrUb6s57Q5dBwMJ4mxpKGyMwjcgLGXPQkx87o8hRfc+twMaL75s k84xi1MjRUq2WrD8CXE2hbYii18jANJ83K1OJ17qz9iWN+Y+/17VnTAQgj94YSInQEHS epNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VgTX1TXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si11550444ioj.39.2021.08.28.23.20.40; Sat, 28 Aug 2021 23:21:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=VgTX1TXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233813AbhH2GRz (ORCPT + 99 others); Sun, 29 Aug 2021 02:17:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:41228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbhH2GRy (ORCPT ); Sun, 29 Aug 2021 02:17:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7D1BC60E94; Sun, 29 Aug 2021 06:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630217822; bh=z9NHJIp+9m32JFBHohbDfSx+jDKGjKtqZOmus2xodAQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VgTX1TXFr9Ojrbsqzv/yCzf3s+/Ti/N+W5hWwnxF3TzS+yZyLtrxJbBX3n/mIUm1j UKkh8MIdXhYAbZeUBnnHuQkWD91ZWBkNEDmnhGHUuA/s585lJxu1Z2zmaGGGait7M4 1MD5WfDr5QqTuX2obk9ezaX6gQ8cshyCWaXdJ8bk= Date: Sun, 29 Aug 2021 08:16:55 +0200 From: Greg KH To: Krish Jain Cc: Bryan Brattlof , linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH] Declare the file_operations struct as const Message-ID: References: <3634721.RBzQ2xsved@localhost.localdomain> <1742120.GgyQvu0Ciu@localhost.localdomain> <20210827233835.px4az5hyqks2n4o5@h510> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 29, 2021 at 04:13:43AM +0200, Krish Jain wrote: > On Sat, Aug 28, 2021 at 1:38 AM Bryan Brattlof wrote: > > As for your patch, I built the driver using: > > > > $ make CCFLAGS=-Werror W=1 M=drivers/staging/android > > > > Which produced the following error: > > > > > > drivers/staging/android/ashmem.c: In function ‘ashmem_mmap’: > > drivers/staging/android/ashmem.c:380:2: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] > > 380 | const static struct file_operations vmfile_fops; > > | ^~~~~ > > drivers/staging/android/ashmem.c:431:16: error: assignment of read-only variable ‘vmfile_fops’ > > 431 | vmfile_fops = *vmfile->f_op; > > | ^ > > drivers/staging/android/ashmem.c:432:21: error: assignment of member ‘mmap’ in read-only object > > 432 | vmfile_fops.mmap = ashmem_vmfile_mmap; > > | ^ > > drivers/staging/android/ashmem.c:433:34: error: assignment of member ‘get_unmapped_area’ in read-only object > > 433 | vmfile_fops.get_unmapped_area = > > | ^ > > make[1]: *** [scripts/Makefile.build:271: drivers/staging/android/ashmem.o] Error 1 > > make: *** [Makefile:1851: drivers/staging/android] Error 2 > > > > Hi, this seems very useful and I tried this myself just now. I don't > get any errors that you do though. When I hit enter I just get a new > shell prompt. What am I doing wrong? Probably a silly mistake. I ran > make CCFLAGS=-Werror M=drivers/staging/android/. Are you sure the file is being built at all? You usually have to select the proper configuration option to enable that driver as well. thanks, greg k-h