From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CD0C32F750 for ; Mon, 1 Sep 2025 15:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756741354; cv=none; b=LAtE1+IYlsmr2w8NsOb77F/t5IjzlaY2NUJHQaICi6lQTg5YI/Dywdmyc/HqYFrYCsljZerTh3swTUBHKV9b7d629w9YMYOahC5Th7J3WWSZ0YVWvtrtk3L4FDJE0wxxIXR7CVHaRPBAiiIHjoYsuGpKJmPcbycZWm66PbZyQJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756741354; c=relaxed/simple; bh=41yILyPaRdGVTtOmRTVGMgEgTRygcovNRJ8+oQjhy8o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rGsOEbeSBdloNipIXXYoUYroGnqh8TOYy1eWHa/8GvvxWH8V9ObiseFkySm2fEQ+y386/28O3dAfurr3pNhnaOVup0L1gJNP3lwiwFqmZZ5lZHkdZCUpplWidL9RZaWM7C+v0vJtcWWudLhn4ODQlGLSNfDw2JYX1YWlxRDNYkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dsS3VYHp; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dsS3VYHp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1756741353; x=1788277353; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=41yILyPaRdGVTtOmRTVGMgEgTRygcovNRJ8+oQjhy8o=; b=dsS3VYHpCcEc+JW+zl96ERoXqbUCS+upAPLLwLHef91roNj43rdZlfin PFGL3dxAyZNkmMmEGLuQDQ5IJFS+oZIUJ2h4QbKdEiYencXfMrV6mHVpK QIAjcL+lSyi55BrL5/Jf52bbo9Wxq2n9eNwRaOAHaPMe8cDIh5NKbn1l4 bTOPCNG/o3AyB+dOTLWVo6ZOOh708MHDhoq6N+RWoZN4zJCmoZRObpbsI z0mi4clAVpcHmM3ce5Xghg9O0mnmBfMr2jZXThaCQBaxItcdhSVfr8Spj 2sq5TfOwb1Q0swnXjd5NZy84blQeaJMSE0gOwPFsax2T5iTdRLbH+8Qu+ g==; X-CSE-ConnectionGUID: FdQshm5PRNCPdp3Ds4OV/A== X-CSE-MsgGUID: SqSSsQgxQxmMww8empxFeQ== X-IronPort-AV: E=McAfee;i="6800,10657,11540"; a="69709200" X-IronPort-AV: E=Sophos;i="6.18,225,1751266800"; d="scan'208";a="69709200" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2025 08:42:33 -0700 X-CSE-ConnectionGUID: iWIyUrZTS6iG0koM7qv4Fw== X-CSE-MsgGUID: lIbgDhB1RhWSK/DxIdYagg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,225,1751266800"; d="scan'208";a="171902172" Received: from smile.fi.intel.com ([10.237.72.52]) by fmviesa010.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2025 08:42:30 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98.2) (envelope-from ) id 1ut6fr-0000000ASaN-3aHa; Mon, 01 Sep 2025 18:42:27 +0300 Date: Mon, 1 Sep 2025 18:42:27 +0300 From: Andy Shevchenko To: Adrian =?utf-8?Q?Barna=C5=9B?= Cc: Hans de Goede , Mauro Carvalho Chehab , Sakari Ailus , Andy Shevchenko , Greg Kroah-Hartman , Dan Carpenter , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH 1/2] staging: media: atomisp: Remove typedefs for basic types in vmem.c Message-ID: References: <20250901091050.1935505-1-abarnas@google.com> <20250901091050.1935505-2-abarnas@google.com> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Mon, Sep 01, 2025 at 03:27:19PM +0200, Adrian Barnaś wrote: > On Mon, Sep 1, 2025 at 2:35 PM Andy Shevchenko > wrote: > > On Mon, Sep 01, 2025 at 09:10:49AM +0000, Adrian Barnaś wrote: ... > > > -static inline hive_uedge > > > -subword(hive_uedge w, unsigned int start, unsigned int end) > > > +static inline unsigned long long > > > +subword(unsigned long long w, unsigned int start, unsigned int end) > > > { > > > return (w & (((1ULL << (end - 1)) - 1) << 1 | 1)) >> start; > > > } > > > > > > /* inverse subword bits move like this: MSB[xxxx____xxxx]LSB -> MSB[xxxx0000xxxx]LSB */ > > > -static inline hive_uedge > > > -inv_subword(hive_uedge w, unsigned int start, unsigned int end) > > > +static inline unsigned long long > > > +inv_subword(unsigned long long w, unsigned int start, unsigned int end) > > > { > > > return w & (~(((1ULL << (end - 1)) - 1) << 1 | 1) | ((1ULL << start) - 1)); > > > } > > > > Also consider to simplify the above (in a separate change). > > > > static inline unsigned long long > > subword(unsigned long long w, unsigned int start, unsigned int end) > > { > > return (w & GENMASK_ULL(end, 0)) >> start; > > } > > > > static inline unsigned long long > > inv_subword(unsigned long long w, unsigned int start, unsigned int end) > > { > > return w & (~GENMASK_ULL(end, 0) | GENMASK_ULL(start, 0)); > > } > > > > ...if I'm not mistaken, so double check all these. > > > > At least in my case the end == 64 is not allowed while it seems the original > > code allows it to be equal to the end == 63 case. Needs testing anyway... > > Those functions works odd: > when (end = 8, start = 0) it affects bits 0...7 Yes, that's what I meant. But it does the same for 7, 0. That's why every caller needs to be carefully checked for these corner cases. 64 is special because it will give complete garbage in my case. I suspect they never extracting anything on the non-aligned byte borders. > This should make the same results, will check twice if i not missed > anything and post v2: > > static inline unsigned long long _subword(unsigned long long w, > unsigned int start, > unsigned int end) > { > return (w & GENMASK_ULL(end-1, 0)) >> start; > } > > static inline unsigned long long _inv_subword(unsigned long long w, > unsigned int start, > unsigned int end) > { > return w & (~GENMASK_ULL(end-1, start)); > } Maybe, but again needs to be carefully checked and tested. You can propose a separate patch as RFC. -- With Best Regards, Andy Shevchenko