static irqreturn_t elog_event(int irq, void *data) { __be64 size; __be64 id; __be64 type; uint64_t elog_size; uint64_t log_id; uint64_t elog_type; int rc; char name[2+16+1]; struct kobject *kobj; rc = opal_get_elog_size(&id, &size, &type); if (rc != OPAL_SUCCESS) { pr_err("ELOG: OPAL log info read failed\n"); return IRQ_HANDLED; } elog_size = be64_to_cpu(size); log_id = be64_to_cpu(id); elog_type = be64_to_cpu(type); WARN_ON(elog_size > OPAL_MAX_ERRLOG_SIZE); if (elog_size >= OPAL_MAX_ERRLOG_SIZE) elog_size = OPAL_MAX_ERRLOG_SIZE; sprintf(name, "0x%llx", log_id); /* we may get notified twice, let's handle * that gracefully and not create two conflicting * entries. */ kobj = kset_find_obj(elog_kset, name); if (kobj) { /* Drop reference added by kset_find_obj() */ kobject_put(kobj); return IRQ_HANDLED; } create_elog_obj(log_id, elog_size, elog_type); return IRQ_HANDLED; }
static void elog_work_fn(struct work_struct *work) { __be64 size; __be64 id; __be64 type; uint64_t elog_size; uint64_t log_id; uint64_t elog_type; int rc; char name[2+16+1]; rc = opal_get_elog_size(&id, &size, &type); if (rc != OPAL_SUCCESS) { pr_err("ELOG: OPAL log info read failed\n"); return; } elog_size = be64_to_cpu(size); log_id = be64_to_cpu(id); elog_type = be64_to_cpu(type); WARN_ON(elog_size > OPAL_MAX_ERRLOG_SIZE); if (elog_size >= OPAL_MAX_ERRLOG_SIZE) elog_size = OPAL_MAX_ERRLOG_SIZE; sprintf(name, "0x%llx", log_id); /* we may get notified twice, let's handle * that gracefully and not create two conflicting * entries. */ if (kset_find_obj(elog_kset, name)) return; create_elog_obj(log_id, elog_size, elog_type); }