mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 02:05:33 +00:00
Merge branch 'acpi-misc' into linux-next
* acpi-misc: media: ipu-bridge: Remove unneeded conditional compilations ACPI: bus: implement acpi_device_hid when !ACPI ACPI: bus: implement for_each_acpi_consumer_dev when !ACPI ACPI: header: implement acpi_device_handle when !ACPI ACPI: bus: implement acpi_get_physical_device_location when !ACPI ACPI: bus: implement for_each_acpi_dev_match when !ACPI ACPI: bus: change the prototype for acpi_get_physical_device_location ACPI: sysfs: Constify 'struct bin_attribute' ACPI: BGRT: Constify 'struct bin_attribute' ACPI: BGRT: Mark bin_attribute as __ro_after_init
This commit is contained in:
commit
977da47ac1
@ -29,7 +29,7 @@ BGRT_SHOW(type, image_type);
|
||||
BGRT_SHOW(xoffset, image_offset_x);
|
||||
BGRT_SHOW(yoffset, image_offset_y);
|
||||
|
||||
static BIN_ATTR_SIMPLE_RO(image);
|
||||
static __ro_after_init BIN_ATTR_SIMPLE_RO(image);
|
||||
|
||||
static struct attribute *bgrt_attributes[] = {
|
||||
&bgrt_attr_version.attr,
|
||||
@ -40,14 +40,14 @@ static struct attribute *bgrt_attributes[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct bin_attribute *bgrt_bin_attributes[] = {
|
||||
static const struct bin_attribute *const bgrt_bin_attributes[] = {
|
||||
&bin_attr_image,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group bgrt_attribute_group = {
|
||||
.attrs = bgrt_attributes,
|
||||
.bin_attrs = bgrt_bin_attributes,
|
||||
.bin_attrs_new = bgrt_bin_attributes,
|
||||
};
|
||||
|
||||
int __init acpi_parse_bgrt(struct acpi_table_header *table)
|
||||
|
@ -624,8 +624,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
|
||||
if (!fwnode_property_present(adev_fwnode, "rotation")) {
|
||||
struct acpi_pld_info *pld;
|
||||
|
||||
status = acpi_get_physical_device_location(handle, &pld);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
if (acpi_get_physical_device_location(handle, &pld)) {
|
||||
swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
|
||||
PROPERTY_ENTRY_U32("rotation",
|
||||
pld->rotation * 45U);
|
||||
|
@ -723,10 +723,8 @@ int acpi_tie_acpi_dev(struct acpi_device *adev)
|
||||
static void acpi_store_pld_crc(struct acpi_device *adev)
|
||||
{
|
||||
struct acpi_pld_info *pld;
|
||||
acpi_status status;
|
||||
|
||||
status = acpi_get_physical_device_location(adev->handle, &pld);
|
||||
if (ACPI_FAILURE(status))
|
||||
if (!acpi_get_physical_device_location(adev->handle, &pld))
|
||||
return;
|
||||
|
||||
adev->pld_crc = crc32(~0, pld, sizeof(*pld));
|
||||
|
@ -319,7 +319,7 @@ struct acpi_data_attr {
|
||||
};
|
||||
|
||||
static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr, char *buf,
|
||||
const struct bin_attribute *bin_attr, char *buf,
|
||||
loff_t offset, size_t count)
|
||||
{
|
||||
struct acpi_table_attr *table_attr =
|
||||
@ -372,7 +372,7 @@ static int acpi_table_attr_init(struct kobject *tables_obj,
|
||||
}
|
||||
|
||||
table_attr->attr.size = table_header->length;
|
||||
table_attr->attr.read = acpi_table_show;
|
||||
table_attr->attr.read_new = acpi_table_show;
|
||||
table_attr->attr.attr.name = table_attr->filename;
|
||||
table_attr->attr.attr.mode = 0400;
|
||||
|
||||
@ -412,7 +412,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context)
|
||||
}
|
||||
|
||||
static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr, char *buf,
|
||||
const struct bin_attribute *bin_attr, char *buf,
|
||||
loff_t offset, size_t count)
|
||||
{
|
||||
struct acpi_data_attr *data_attr;
|
||||
@ -495,7 +495,7 @@ static int acpi_table_data_init(struct acpi_table_header *th)
|
||||
if (!data_attr)
|
||||
return -ENOMEM;
|
||||
sysfs_attr_init(&data_attr->attr.attr);
|
||||
data_attr->attr.read = acpi_data_show;
|
||||
data_attr->attr.read_new = acpi_data_show;
|
||||
data_attr->attr.attr.mode = 0400;
|
||||
return acpi_data_objs[i].fn(th, data_attr);
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ bool acpi_device_dep(acpi_handle target, acpi_handle match)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_device_dep);
|
||||
|
||||
acpi_status
|
||||
bool
|
||||
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld)
|
||||
{
|
||||
acpi_status status;
|
||||
@ -502,9 +502,8 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
|
||||
union acpi_object *output;
|
||||
|
||||
status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer);
|
||||
|
||||
if (ACPI_FAILURE(status))
|
||||
return status;
|
||||
return false;
|
||||
|
||||
output = buffer.pointer;
|
||||
|
||||
@ -523,7 +522,7 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
|
||||
|
||||
out:
|
||||
kfree(buffer.pointer);
|
||||
return status;
|
||||
return ACPI_SUCCESS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_get_physical_device_location);
|
||||
|
||||
|
@ -13,13 +13,11 @@
|
||||
bool dev_add_physical_location(struct device *dev)
|
||||
{
|
||||
struct acpi_pld_info *pld;
|
||||
acpi_status status;
|
||||
|
||||
if (!has_acpi_companion(dev))
|
||||
return false;
|
||||
|
||||
status = acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld);
|
||||
if (ACPI_FAILURE(status))
|
||||
if (!acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld))
|
||||
return false;
|
||||
|
||||
dev->physical_location =
|
||||
|
@ -2,6 +2,7 @@
|
||||
/* Author: Dan Scally <djrscally@gmail.com> */
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <acpi/acpi_bus.h>
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/i2c.h>
|
||||
@ -107,7 +108,6 @@ static const char * const ipu_vcm_types[] = {
|
||||
"lc898212axb",
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI)
|
||||
/*
|
||||
* Used to figure out IVSC acpi device by ipu_bridge_get_ivsc_acpi_dev()
|
||||
* instead of device and driver match to probe IVSC device.
|
||||
@ -127,11 +127,11 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev
|
||||
const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i];
|
||||
struct acpi_device *consumer, *ivsc_adev;
|
||||
|
||||
acpi_handle handle = acpi_device_handle(adev);
|
||||
acpi_handle handle = acpi_device_handle(ACPI_PTR(adev));
|
||||
for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1)
|
||||
/* camera sensor depends on IVSC in DSDT if exist */
|
||||
for_each_acpi_consumer_dev(ivsc_adev, consumer)
|
||||
if (consumer->handle == handle) {
|
||||
if (ACPI_PTR(consumer->handle) == handle) {
|
||||
acpi_dev_put(consumer);
|
||||
return ivsc_adev;
|
||||
}
|
||||
@ -139,12 +139,6 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int ipu_bridge_match_ivsc_dev(struct device *dev, const void *adev)
|
||||
{
|
||||
@ -259,12 +253,8 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
|
||||
{
|
||||
enum v4l2_fwnode_orientation orientation;
|
||||
struct acpi_pld_info *pld = NULL;
|
||||
acpi_status status = AE_ERROR;
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI)
|
||||
status = acpi_get_physical_device_location(adev->handle, &pld);
|
||||
#endif
|
||||
if (ACPI_FAILURE(status)) {
|
||||
if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) {
|
||||
dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
|
||||
return V4L2_FWNODE_ORIENTATION_EXTERNAL;
|
||||
}
|
||||
@ -498,9 +488,7 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge,
|
||||
if (sensor->csi_dev) {
|
||||
const char *device_hid = "";
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI)
|
||||
device_hid = acpi_device_hid(sensor->ivsc_adev);
|
||||
#endif
|
||||
|
||||
snprintf(sensor->ivsc_name, sizeof(sensor->ivsc_name), "%s-%u",
|
||||
device_hid, sensor->link);
|
||||
@ -671,11 +659,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
|
||||
struct acpi_device *adev = NULL;
|
||||
int ret;
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI)
|
||||
for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
|
||||
#else
|
||||
while (true) {
|
||||
#endif
|
||||
if (!ACPI_PTR(adev->status.enabled))
|
||||
continue;
|
||||
|
||||
@ -768,15 +752,10 @@ static int ipu_bridge_ivsc_is_ready(void)
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) {
|
||||
#if IS_ENABLED(CONFIG_ACPI)
|
||||
const struct ipu_sensor_config *cfg =
|
||||
&ipu_supported_sensors[i];
|
||||
|
||||
for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) {
|
||||
#else
|
||||
while (true) {
|
||||
sensor_adev = NULL;
|
||||
#endif
|
||||
if (!ACPI_PTR(sensor_adev->status.enabled))
|
||||
continue;
|
||||
|
||||
|
@ -213,8 +213,7 @@ usb_acpi_get_connect_type(struct usb_port *port_dev, acpi_handle *handle)
|
||||
* no connectable, the port would be not used.
|
||||
*/
|
||||
|
||||
status = acpi_get_physical_device_location(handle, &pld);
|
||||
if (ACPI_SUCCESS(status) && pld)
|
||||
if (acpi_get_physical_device_location(handle, &pld) && pld)
|
||||
port_dev->location = USB_ACPI_LOCATION_VALID |
|
||||
pld->group_token << 8 | pld->group_position;
|
||||
|
||||
|
@ -43,9 +43,6 @@ acpi_status
|
||||
acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
|
||||
struct acpi_buffer *status_buf);
|
||||
|
||||
acpi_status
|
||||
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
|
||||
|
||||
bool acpi_has_method(acpi_handle handle, char *name);
|
||||
acpi_status acpi_execute_simple_method(acpi_handle handle, char *method,
|
||||
u64 arg);
|
||||
@ -60,6 +57,9 @@ bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
|
||||
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
|
||||
u64 rev, u64 func, union acpi_object *argv4);
|
||||
#ifdef CONFIG_ACPI
|
||||
bool
|
||||
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
|
||||
|
||||
static inline union acpi_object *
|
||||
acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
|
||||
u64 func, union acpi_object *argv4,
|
||||
@ -1003,6 +1003,23 @@ static inline int unregister_acpi_bus_type(void *bus) { return 0; }
|
||||
|
||||
static inline int acpi_wait_for_acpi_ipmi(void) { return 0; }
|
||||
|
||||
static inline const char *acpi_device_hid(struct acpi_device *device)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline bool
|
||||
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#define for_each_acpi_consumer_dev(supplier, consumer) \
|
||||
for (consumer = NULL; false && (supplier);)
|
||||
|
||||
#define for_each_acpi_dev_match(adev, hid, uid, hrv) \
|
||||
for (adev = NULL; false && (hid) && (uid) && (hrv); )
|
||||
|
||||
#endif /* CONFIG_ACPI */
|
||||
|
||||
#endif /*__ACPI_BUS_H__*/
|
||||
|
@ -854,6 +854,11 @@ static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool has_acpi_companion(struct device *dev)
|
||||
{
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user