Revert "tty: hvc: Fix data abort due to race in hvc_open"
[linux/fpc-iii.git] / arch / x86 / platform / uv / uv_sysfs.c
blob62214731fea5e54bca7b7c99f494fcac026dcc68
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * This file supports the /sys/firmware/sgi_uv interfaces for SGI UV.
5 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
6 * Copyright (c) Russ Anderson
7 */
9 #include <linux/device.h>
10 #include <asm/uv/bios.h>
11 #include <asm/uv/uv.h>
13 struct kobject *sgi_uv_kobj;
15 static ssize_t partition_id_show(struct kobject *kobj,
16 struct kobj_attribute *attr, char *buf)
18 return snprintf(buf, PAGE_SIZE, "%ld\n", sn_partition_id);
21 static ssize_t coherence_id_show(struct kobject *kobj,
22 struct kobj_attribute *attr, char *buf)
24 return snprintf(buf, PAGE_SIZE, "%ld\n", uv_partition_coherence_id());
27 static struct kobj_attribute partition_id_attr =
28 __ATTR(partition_id, S_IRUGO, partition_id_show, NULL);
30 static struct kobj_attribute coherence_id_attr =
31 __ATTR(coherence_id, S_IRUGO, coherence_id_show, NULL);
34 static int __init sgi_uv_sysfs_init(void)
36 unsigned long ret;
38 if (!is_uv_system())
39 return -ENODEV;
41 if (!sgi_uv_kobj)
42 sgi_uv_kobj = kobject_create_and_add("sgi_uv", firmware_kobj);
43 if (!sgi_uv_kobj) {
44 printk(KERN_WARNING "kobject_create_and_add sgi_uv failed\n");
45 return -EINVAL;
48 ret = sysfs_create_file(sgi_uv_kobj, &partition_id_attr.attr);
49 if (ret) {
50 printk(KERN_WARNING "sysfs_create_file partition_id failed\n");
51 return ret;
54 ret = sysfs_create_file(sgi_uv_kobj, &coherence_id_attr.attr);
55 if (ret) {
56 printk(KERN_WARNING "sysfs_create_file coherence_id failed\n");
57 return ret;
60 return 0;
63 device_initcall(sgi_uv_sysfs_init);