Re: [PATCH v4 5/8] ACPI: property: Dig "rotation" property for devices with CSI2 _CRS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

On Wed, Feb 08, 2023 at 06:51:17PM +0200, Andy Shevchenko wrote:
> On Wed, Feb 08, 2023 at 05:28:04PM +0200, Sakari Ailus wrote:
> > Dig "rotation" property value for devices with _CRS CSI2 resource
> > descriptor. The value comes from _PLD (physical location of device)
> > object, if it exists for the device.
> > 
> > This way camera sensor drivers that know the "rotation" property do not
> > need to care about _PLD on ACPI.
> 
> ...
> 
> > +	/*
> > +	 * Check if "rotation" property exists and if it doesn't but there's a
> > +	 * _PLD object, then get the rotation value from there.
> > +	 */
> > +	if (fwnode_property_read_u32(fwnode, "rotation", &val) &&
> > +	    ACPI_SUCCESS(acpi_get_physical_device_location(acpi_device_handle(device),
> > +							   &pld))) {
> 
> > +	if (fwnode_property_read_u32(fwnode, "rotation", &val) &&
> > +	    ACPI_SUCCESS(acpi_get_physical_device_location(acpi_device_handle(device),
> > +							   &pld))) {
> 
> Wouldn't be a bit better to use temporary variables for this?
> 
> 	ret = fwnode_property_read_u32(fwnode, "rotation", &val);
> 	if (ret) {
> 		acpi_handle handle = acpi_device_handle(device);
> 		acpi_status status;
> 
> 		status = acpi_get_physical_device_location(handle, &pld);
> 		if (ACPI_SUCCESS(status)) {
> 			...
> 		}
> 	}
> 
> ?

It seems that val isn't used. So I'll use fwnode_property_present() which
I think is fine to test in if () directly.

-- 
Sakari Ailus



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux