Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7332022rwr; Tue, 2 May 2023 13:02:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lWLK3p80EeFUmBcZVgHzshdrPNFv0tOhvge5zFwI4sN8NyOM/a05XazLy3FqtauGokvet X-Received: by 2002:aa7:88c7:0:b0:63b:8cbc:bc0f with SMTP id k7-20020aa788c7000000b0063b8cbcbc0fmr26326774pff.22.1683057754424; Tue, 02 May 2023 13:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683057754; cv=none; d=google.com; s=arc-20160816; b=M57l+9hjFm/F3avI+ShSladxs19euw5bvr6AvAWlRQtUMwKGnzoW+XhfqufRqUe+LT b+p1w2RI1FF1iIoDmVNXGcBe149holEJOWmiK+4ITDYf8Pt4IVLv/gPOqOu1DdvlaUoS DWtg72bPKnFNO+iTuldcc6Ricl/mYP2Vn4AbJ3SUCJvNGxyaJbj30Id0r4CXkzK04Qx0 PsCR8k4laoDdf+fQeLQ7xVXjBGMeoDb3AxyumpWXiWapdjPA6QTx5ikkteYSGUxywqBm 8mctUxuuTyoYwZJEVzEl3qhj+QUUSUbyj5v28d8w1qnPF0jzsHAqpqQJZL9NGZPpEWWh /Xtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=y+VwXrj1d1yP6khHv5aiL2YhkImoMROzj59s+LDQYe8=; b=yUidIqFpKWcYNNX3rnDaRf0VvOL6hJMrpA9To1oLpvxgiArn90sl0gau2z7QBiqnAH 8EPV/B2gMRC3JyTFH3jc790fa0tTtAtJ7vyyXU0/4Y/lPwGqOLKmCq3YwY+6OdAlULk2 WhP7jzTSpGtTePl4ZdIuzXCLtbV+yAlkV7JNZtHJ/It9rauM4a/NBjaUFtDGp+f2LoYl IG1DX8ZH22A4eSEk/WMwVLPphP8+Umk0IiklzkHTrOovJCz7pdfuUMiEfFM6iJAuXOvf v+lVZW2pQzDesGm4v8FUfS/mFzGpZMxfyATbyJsUDCPFh7MuZv50bdJ+UsOoaMhGEZly P8yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kSM58eOD; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a621d0b000000b0063b7c4435c0si30579768pfd.54.2023.05.02.13.02.18; Tue, 02 May 2023 13:02:34 -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=@intel.com header.s=Intel header.b=kSM58eOD; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229532AbjEBTli (ORCPT + 99 others); Tue, 2 May 2023 15:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjEBTlg (ORCPT ); Tue, 2 May 2023 15:41:36 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1810511B; Tue, 2 May 2023 12:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683056496; x=1714592496; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aUIYjVCQRHRlfXDMj7fFiF8cdLlvmxD/u1gXezinv5I=; b=kSM58eOD9AUOcATx6vejqkSsFI4dAZ6dMgRdzm4E56R/bS290XwT23dK dghvogwtMSe3Wzozdvdnhxk8kbEPspUxGKMj32GurAz0GZIeZOdRYl5gv 1zehYi9yDyXVGQmRQ7pR8M5f6HiKR2Hm11Am7oSgb91Ovw1/jpb+oloOF uYo41atKFhYEU/Of8HX6F0aiEu7+nRTLDZ0FVVOrgqVzL6Aw6xTpRhQHf V458hsL0ejiTQbkHw1Uwq8BCqPSy6EwIpYIS8/Ati3QwvmMOK34i77fx4 rUlmkF/RsXML4Sn2Y5w7CdZsYRsVEMQ/kqUCcnt/CICTaG6jzwamApjcV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10698"; a="351468220" X-IronPort-AV: E=Sophos;i="5.99,245,1677571200"; d="scan'208";a="351468220" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2023 12:41:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10698"; a="761238064" X-IronPort-AV: E=Sophos;i="5.99,245,1677571200"; d="scan'208";a="761238064" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga008.fm.intel.com with ESMTP; 02 May 2023 12:41:33 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1ptvsR-008CrM-1h; Tue, 02 May 2023 22:41:31 +0300 Date: Tue, 2 May 2023 22:41:31 +0300 From: Andy Shevchenko To: Jonathan Cameron Cc: Mehdi Djait , Andi Shyti , mazziesaccount@gmail.com, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v3 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Message-ID: References: <20230425155734.ywdle4pv6y2wjk2s@intel.intel> <20230430184910.48d6c1b4@jic23-huawei> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230430184910.48d6c1b4@jic23-huawei> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Sun, Apr 30, 2023 at 06:49:10PM +0100, Jonathan Cameron wrote: > On Sat, 29 Apr 2023 15:07:46 +0200 > Mehdi Djait wrote: > > On Tue, Apr 25, 2023 at 05:57:34PM +0200, Andi Shyti wrote: > > > On Tue, Apr 25, 2023 at 12:22:25AM +0200, Mehdi Djait wrote: ... > > > > + chip_info = device_get_match_data(&spi->dev); > > > > + if (!chip_info) { > > > > + const struct spi_device_id *id = spi_get_device_id(spi); > > > > + chip_info = (const struct kx022a_chip_info *)id->driver_data; > > > > > > you don't need the cast here... if you don't find it messy, I > > > wouldn't mind this form... some hate it, I find it easier to > > > read: > > > > > > chip_info = spi_get_device_id(spi)->driver_data; > > > > > > your choice. > > > > I don't really have any strong opinion about this other than keeping the > > same style used in iio drivers > > > > Again thank you for the review > > I'm fairly sure the cast is needed because driver_data is (via defines) > an unsigned long, which you cannot implicitly cast to a pointer without > various warnings being generated. Instead we have a specific SPI provided helper for the above, please use it instead of open coded stuff. -- With Best Regards, Andy Shevchenko